From 3c12cd49ecf8bdcd8c4ce82cb449836b7a02d4fb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 14:21:50 +0100 Subject: Simplify ctor --- editors/code/src/ctx.ts | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'editors/code/src/ctx.ts') 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'; import { createClient } from './client'; export class Ctx { - readonly config: Config; - // Because we have "reload server" action, various listeners **will** face a - // situation where the client is not ready yet, and should be prepared to - // deal with it. - // - // Ideally, this should be replaced with async getter though. - // FIXME: this actually needs syncronization of some kind (check how - // vscode deals with `deactivate()` call when extension has some work scheduled - // on the event loop to get a better picture of what we can do here) - client: lc.LanguageClient; - private extCtx: vscode.ExtensionContext; + private constructor( + readonly config: Config, + private readonly extCtx: vscode.ExtensionContext, + readonly client: lc.LanguageClient + ) { + + } static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise { const client = await createClient(config, serverPath); @@ -25,12 +21,6 @@ export class Ctx { return res; } - private constructor(config: Config, extCtx: vscode.ExtensionContext, client: lc.LanguageClient) { - this.config = config; - this.extCtx = extCtx; - this.client = client - } - get activeRustEditor(): vscode.TextEditor | undefined { const editor = vscode.window.activeTextEditor; return editor && editor.document.languageId === 'rust' -- cgit v1.2.3