From ae662617a2bc49d025adaf9c4a8ff2dfa557d36c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 16 Mar 2020 19:23:38 +0100 Subject: Separate persistent mutable state from config That way, we clearly see which things are not change, and we also clearly see which things are persistent. --- editors/code/src/ctx.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'editors/code/src/ctx.ts') diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 25ef38aed..c929ab063 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -4,19 +4,21 @@ import * as lc from 'vscode-languageclient'; import { Config } from './config'; import { createClient } from './client'; import { isRustEditor, RustEditor } from './util'; +import { PersistentState } from './persistent_state'; export class Ctx { private constructor( readonly config: Config, + readonly state: PersistentState, private readonly extCtx: vscode.ExtensionContext, readonly client: lc.LanguageClient ) { } - static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise { + static async create(config: Config, state: PersistentState, extCtx: vscode.ExtensionContext, serverPath: string): Promise { const client = await createClient(config, serverPath); - const res = new Ctx(config, extCtx, client); + const res = new Ctx(config, state, extCtx, client); res.pushCleanup(client.start()); await client.onReady(); return res; -- cgit v1.2.3