aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/ctx.ts
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-30 14:11:30 +0000
committerAleksey Kladov <[email protected]>2019-12-30 14:11:30 +0000
commit57df9bed703bd0f8b7a7cc593152b65b543ad121 (patch)
tree3e780c0fdd5c0d131d228747952424e6d43bfcb6 /editors/code/src/ctx.ts
parenta0c035096053529944dbb49c148371a8ad9b3fc0 (diff)
Run prettier
Diffstat (limited to 'editors/code/src/ctx.ts')
-rw-r--r--editors/code/src/ctx.ts16
1 files changed, 6 insertions, 10 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 9dd2b7d4f..87f1574d3 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -2,30 +2,26 @@ import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient'; 2import * as lc from 'vscode-languageclient';
3import { Server } from './server'; 3import { Server } from './server';
4 4
5
6export class Ctx { 5export class Ctx {
7 private extCtx: vscode.ExtensionContext 6 private extCtx: vscode.ExtensionContext;
8 7
9 constructor(extCtx: vscode.ExtensionContext) { 8 constructor(extCtx: vscode.ExtensionContext) {
10 this.extCtx = extCtx 9 this.extCtx = extCtx;
11 } 10 }
12 11
13 get client(): lc.LanguageClient { 12 get client(): lc.LanguageClient {
14 return Server.client 13 return Server.client;
15 } 14 }
16 15
17 registerCommand( 16 registerCommand(name: string, factory: (ctx: Ctx) => Cmd) {
18 name: string, 17 const fullName = `rust-analyzer.${name}`;
19 factory: (ctx: Ctx) => Cmd,
20 ) {
21 const fullName = `rust-analyzer.${name}`
22 const cmd = factory(this); 18 const cmd = factory(this);
23 const d = vscode.commands.registerCommand(fullName, cmd); 19 const d = vscode.commands.registerCommand(fullName, cmd);
24 this.pushCleanup(d); 20 this.pushCleanup(d);
25 } 21 }
26 22
27 pushCleanup(d: { dispose(): any }) { 23 pushCleanup(d: { dispose(): any }) {
28 this.extCtx.subscriptions.push(d) 24 this.extCtx.subscriptions.push(d);
29 } 25 }
30} 26}
31 27