@@ -23,12 +23,12 @@ export class Ctx {
23
23
readonly config : Config ;
24
24
25
25
private client : lc . LanguageClient | undefined ;
26
+ private _serverPath : string | undefined ;
27
+ private traceOutputChannel : vscode . OutputChannel | undefined ;
28
+ private outputChannel : vscode . OutputChannel | undefined ;
29
+ private state : PersistentState ;
26
30
27
- traceOutputChannel : vscode . OutputChannel | undefined ;
28
- outputChannel : vscode . OutputChannel | undefined ;
29
31
workspace : Workspace ;
30
- state : PersistentState ;
31
- serverPath : string | undefined ;
32
32
33
33
constructor ( readonly extCtx : vscode . ExtensionContext , workspace : Workspace ) {
34
34
this . statusBar = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left ) ;
@@ -70,21 +70,24 @@ export class Ctx {
70
70
if ( ! this . client ) {
71
71
log . info ( "Creating language client" ) ;
72
72
73
- this . serverPath = await bootstrap ( this . extCtx , this . config , this . state ) . catch ( ( err ) => {
74
- let message = "bootstrap error. " ;
73
+ this . _serverPath = await bootstrap ( this . extCtx , this . config , this . state ) . catch (
74
+ ( err ) => {
75
+ let message = "bootstrap error. " ;
75
76
76
- message +=
77
- 'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). ' ;
78
- message += 'To enable verbose logs use { "rust-analyzer.trace.extension": true }' ;
77
+ message +=
78
+ 'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). ' ;
79
+ message +=
80
+ 'To enable verbose logs use { "rust-analyzer.trace.extension": true }' ;
79
81
80
- log . error ( "Bootstrap error" , err ) ;
81
- throw new Error ( message ) ;
82
- } ) ;
82
+ log . error ( "Bootstrap error" , err ) ;
83
+ throw new Error ( message ) ;
84
+ }
85
+ ) ;
83
86
const newEnv = substituteVariablesInEnv (
84
87
Object . assign ( { } , process . env , this . config . serverExtraEnv )
85
88
) ;
86
89
const run : lc . Executable = {
87
- command : this . serverPath ,
90
+ command : this . _serverPath ,
88
91
options : { env : newEnv } ,
89
92
} ;
90
93
const serverOptions = {
@@ -129,7 +132,7 @@ export class Ctx {
129
132
async disposeClient ( ) {
130
133
log . info ( "Deactivating language client" ) ;
131
134
await this . client ?. dispose ( ) ;
132
- this . serverPath = undefined ;
135
+ this . _serverPath = undefined ;
133
136
this . client = undefined ;
134
137
}
135
138
@@ -161,6 +164,10 @@ export class Ctx {
161
164
return this . extCtx . subscriptions ;
162
165
}
163
166
167
+ get serverPath ( ) : string | undefined {
168
+ return this . _serverPath ;
169
+ }
170
+
164
171
setServerStatus ( status : ServerStatusParams ) {
165
172
let icon = "" ;
166
173
const statusBar = this . statusBar ;
0 commit comments