@@ -5,17 +5,13 @@ import { Config } from './config';
5
5
import { createClient } from './client' ;
6
6
7
7
export class Ctx {
8
- readonly config : Config ;
9
- // Because we have "reload server" action, various listeners **will** face a
10
- // situation where the client is not ready yet, and should be prepared to
11
- // deal with it.
12
- //
13
- // Ideally, this should be replaced with async getter though.
14
- // FIXME: this actually needs syncronization of some kind (check how
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 ;
8
+ private constructor (
9
+ readonly config : Config ,
10
+ private readonly extCtx : vscode . ExtensionContext ,
11
+ readonly client : lc . LanguageClient
12
+ ) {
13
+
14
+ }
19
15
20
16
static async create ( config : Config , extCtx : vscode . ExtensionContext , serverPath : string ) : Promise < Ctx > {
21
17
const client = await createClient ( config , serverPath ) ;
@@ -25,12 +21,6 @@ export class Ctx {
25
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
24
get activeRustEditor ( ) : vscode . TextEditor | undefined {
35
25
const editor = vscode . window . activeTextEditor ;
36
26
return editor && editor . document . languageId === 'rust'
0 commit comments