about summary refs log tree commit diff
path: root/editors/code/src/ctx.ts
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2022-10-17 15:05:20 +0200
committerLukas Wirth <lukastw97@gmail.com>2022-10-17 15:05:20 +0200
commitd68616a140b35dd9bc4e2982e0993257ab0942e0 (patch)
tree3e5b22940e813be4ca26ad61c66191a5db500554 /editors/code/src/ctx.ts
parent8aaafddee8ad709438a663084e6eec8f458bfd50 (diff)
downloadrust-d68616a140b35dd9bc4e2982e0993257ab0942e0.tar.gz
rust-d68616a140b35dd9bc4e2982e0993257ab0942e0.zip
Make more things private
Diffstat (limited to 'editors/code/src/ctx.ts')
-rw-r--r--editors/code/src/ctx.ts35
1 files changed, 21 insertions, 14 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index f62ccd1a652..6b12d9ca1ec 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -23,12 +23,12 @@ export class Ctx {
     readonly config: Config;
 
     private client: lc.LanguageClient | undefined;
+    private _serverPath: string | undefined;
+    private traceOutputChannel: vscode.OutputChannel | undefined;
+    private outputChannel: vscode.OutputChannel | undefined;
+    private state: PersistentState;
 
-    traceOutputChannel: vscode.OutputChannel | undefined;
-    outputChannel: vscode.OutputChannel | undefined;
     workspace: Workspace;
-    state: PersistentState;
-    serverPath: string | undefined;
 
     constructor(readonly extCtx: vscode.ExtensionContext, workspace: Workspace) {
         this.statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
@@ -70,21 +70,24 @@ export class Ctx {
         if (!this.client) {
             log.info("Creating language client");
 
-            this.serverPath = await bootstrap(this.extCtx, this.config, this.state).catch((err) => {
-                let message = "bootstrap error. ";
+            this._serverPath = await bootstrap(this.extCtx, this.config, this.state).catch(
+                (err) => {
+                    let message = "bootstrap error. ";
 
-                message +=
-                    'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). ';
-                message += 'To enable verbose logs use { "rust-analyzer.trace.extension": true }';
+                    message +=
+                        'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). ';
+                    message +=
+                        'To enable verbose logs use { "rust-analyzer.trace.extension": true }';
 
-                log.error("Bootstrap error", err);
-                throw new Error(message);
-            });
+                    log.error("Bootstrap error", err);
+                    throw new Error(message);
+                }
+            );
             const newEnv = substituteVariablesInEnv(
                 Object.assign({}, process.env, this.config.serverExtraEnv)
             );
             const run: lc.Executable = {
-                command: this.serverPath,
+                command: this._serverPath,
                 options: { env: newEnv },
             };
             const serverOptions = {
@@ -129,7 +132,7 @@ export class Ctx {
     async disposeClient() {
         log.info("Deactivating language client");
         await this.client?.dispose();
-        this.serverPath = undefined;
+        this._serverPath = undefined;
         this.client = undefined;
     }
 
@@ -161,6 +164,10 @@ export class Ctx {
         return this.extCtx.subscriptions;
     }
 
+    get serverPath(): string | undefined {
+        return this._serverPath;
+    }
+
     setServerStatus(status: ServerStatusParams) {
         let icon = "";
         const statusBar = this.statusBar;