Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/ctx.ts')
-rw-r--r--editors/code/src/ctx.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index ac73f2ae6b..37a2ee2369 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -5,6 +5,7 @@ import * as ra from "./lsp_ext";
import { Config, prepareVSCodeConfig } from "./config";
import { createClient } from "./client";
import {
+ isCargoTomlEditor,
isDocumentInWorkspace,
isRustDocument,
isRustEditor,
@@ -429,6 +430,11 @@ export class Ctx implements RustAnalyzerExtensionApi {
return editor && isRustEditor(editor) ? editor : undefined;
}
+ get activeCargoTomlEditor(): RustEditor | undefined {
+ const editor = vscode.window.activeTextEditor;
+ return editor && isCargoTomlEditor(editor) ? editor : undefined;
+ }
+
get extensionPath(): string {
return this.extCtx.extensionPath;
}