diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-16 21:02:37 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-16 21:02:37 +0000 |
commit | 7dbd040c2639a69605f41489f4fc93129e9fab7e (patch) | |
tree | f321ad0a529283bbb276095da7644d8f1ba663d2 /editors/code/src/ctx.ts | |
parent | d3773ec1522681de117d354f0c82e753c68c6d0b (diff) | |
parent | ae662617a2bc49d025adaf9c4a8ff2dfa557d36c (diff) |
Merge #3614
3614: Separate persistent mutable state from config r=matklad a=matklad
That way, we clearly see which things are not change, and we also
clearly see which things are persistent.
r? @Veetaha
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'editors/code/src/ctx.ts')
-rw-r--r-- | editors/code/src/ctx.ts | 6 |
1 files changed, 4 insertions, 2 deletions
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'; | |||
4 | import { Config } from './config'; | 4 | import { Config } from './config'; |
5 | import { createClient } from './client'; | 5 | import { createClient } from './client'; |
6 | import { isRustEditor, RustEditor } from './util'; | 6 | import { isRustEditor, RustEditor } from './util'; |
7 | import { PersistentState } from './persistent_state'; | ||
7 | 8 | ||
8 | export class Ctx { | 9 | export class Ctx { |
9 | private constructor( | 10 | private constructor( |
10 | readonly config: Config, | 11 | readonly config: Config, |
12 | readonly state: PersistentState, | ||
11 | private readonly extCtx: vscode.ExtensionContext, | 13 | private readonly extCtx: vscode.ExtensionContext, |
12 | readonly client: lc.LanguageClient | 14 | readonly client: lc.LanguageClient |
13 | ) { | 15 | ) { |
14 | 16 | ||
15 | } | 17 | } |
16 | 18 | ||
17 | static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise<Ctx> { | 19 | static async create(config: Config, state: PersistentState, extCtx: vscode.ExtensionContext, serverPath: string): Promise<Ctx> { |
18 | const client = await createClient(config, serverPath); | 20 | const client = await createClient(config, serverPath); |
19 | const res = new Ctx(config, extCtx, client); | 21 | const res = new Ctx(config, state, extCtx, client); |
20 | res.pushCleanup(client.start()); | 22 | res.pushCleanup(client.start()); |
21 | await client.onReady(); | 23 | await client.onReady(); |
22 | return res; | 24 | return res; |