aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-17 13:21:50 +0000
committerAleksey Kladov <[email protected]>2020-02-17 13:22:09 +0000
commit3c12cd49ecf8bdcd8c4ce82cb449836b7a02d4fb (patch)
treee4656586e273dc19cda8d50f6f3b95f901cfb9f2 /editors
parent7dccfd9183cc10acae7ead993979c3261fbe37ca (diff)
Simplify ctor
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/ctx.ts24
1 files changed, 7 insertions, 17 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 21f1025cf..dfc8aa7b9 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -5,17 +5,13 @@ import { Config } from './config';
5import { createClient } from './client'; 5import { createClient } from './client';
6 6
7export class Ctx { 7export class Ctx {
8 readonly config: Config; 8 private constructor(
9 // Because we have "reload server" action, various listeners **will** face a 9 readonly config: Config,
10 // situation where the client is not ready yet, and should be prepared to 10 private readonly extCtx: vscode.ExtensionContext,
11 // deal with it. 11 readonly client: lc.LanguageClient
12 // 12 ) {
13 // Ideally, this should be replaced with async getter though. 13
14 // FIXME: this actually needs syncronization of some kind (check how 14 }
15 // vscode deals with `deactivate()` call when extension has some work scheduled
16 // on the event loop to get a better picture of what we can do here)
17 client: lc.LanguageClient;
18 private extCtx: vscode.ExtensionContext;
19 15
20 static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise<Ctx> { 16 static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise<Ctx> {
21 const client = await createClient(config, serverPath); 17 const client = await createClient(config, serverPath);
@@ -25,12 +21,6 @@ export class Ctx {
25 return res; 21 return res;
26 } 22 }
27 23
28 private constructor(config: Config, extCtx: vscode.ExtensionContext, client: lc.LanguageClient) {
29 this.config = config;
30 this.extCtx = extCtx;
31 this.client = client
32 }
33
34 get activeRustEditor(): vscode.TextEditor | undefined { 24 get activeRustEditor(): vscode.TextEditor | undefined {
35 const editor = vscode.window.activeTextEditor; 25 const editor = vscode.window.activeTextEditor;
36 return editor && editor.document.languageId === 'rust' 26 return editor && editor.document.languageId === 'rust'