]> git.lizzy.rs Git - rust.git/blobdiff - editors/code/src/ctx.ts
Move matching brace to new Ctx
[rust.git] / editors / code / src / ctx.ts
index 87f1574d38058a4376d2541d23eb4bc45984dba4..712337fe71c582c92cf6d48220e6b8e44f56c530 100644 (file)
@@ -13,6 +13,13 @@ export class Ctx {
         return Server.client;
     }
 
+    get activeRustEditor(): vscode.TextEditor | undefined {
+        const editor = vscode.window.activeTextEditor;
+        return editor && editor.document.languageId === 'rust'
+            ? editor
+            : undefined;
+    }
+
     registerCommand(name: string, factory: (ctx: Ctx) => Cmd) {
         const fullName = `rust-analyzer.${name}`;
         const cmd = factory(this);