Move matching brace to new Ctx

This commit is contained in:
Aleksey Kladov 2019-12-30 15:20:13 +01:00
parent 57df9bed70
commit 5dd9edaeaf
4 changed files with 35 additions and 32 deletions

View 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);