Skip to content

Commit 3c12cd4

Browse files
committed
Simplify ctor
1 parent 7dccfd9 commit 3c12cd4

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

editors/code/src/ctx.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@ import { Config } from './config';
55
import { createClient } from './client';
66

77
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+
}
1915

2016
static async create(config: Config, extCtx: vscode.ExtensionContext, serverPath: string): Promise<Ctx> {
2117
const client = await createClient(config, serverPath);
@@ -25,12 +21,6 @@ export class Ctx {
2521
return res;
2622
}
2723

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-
3424
get activeRustEditor(): vscode.TextEditor | undefined {
3525
const editor = vscode.window.activeTextEditor;
3626
return editor && editor.document.languageId === 'rust'

0 commit comments

Comments
 (0)