aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/ctx.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/ctx.ts')
-rw-r--r--editors/code/src/ctx.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 87f1574d3..712337fe7 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -13,6 +13,13 @@ export class Ctx {
13 return Server.client; 13 return Server.client;
14 } 14 }
15 15
16 get activeRustEditor(): vscode.TextEditor | undefined {
17 const editor = vscode.window.activeTextEditor;
18 return editor && editor.document.languageId === 'rust'
19 ? editor
20 : undefined;
21 }
22
16 registerCommand(name: string, factory: (ctx: Ctx) => Cmd) { 23 registerCommand(name: string, factory: (ctx: Ctx) => Cmd) {
17 const fullName = `rust-analyzer.${name}`; 24 const fullName = `rust-analyzer.${name}`;
18 const cmd = factory(this); 25 const cmd = factory(this);