@@ -75,7 +75,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
75
75
private _client : lc . LanguageClient | undefined ;
76
76
private _serverPath : string | undefined ;
77
77
private traceOutputChannel : vscode . OutputChannel | undefined ;
78
- private testController : vscode . TestController ;
78
+ private testController : vscode . TestController | undefined ;
79
79
private outputChannel : vscode . OutputChannel | undefined ;
80
80
private clientSubscriptions : Disposable [ ] ;
81
81
private state : PersistentState ;
@@ -104,18 +104,20 @@ export class Ctx implements RustAnalyzerExtensionApi {
104
104
workspace : Workspace ,
105
105
) {
106
106
extCtx . subscriptions . push ( this ) ;
107
+ this . config = new Config ( extCtx ) ;
107
108
this . statusBar = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Left ) ;
108
- this . testController = vscode . tests . createTestController (
109
- "rustAnalyzerTestController" ,
110
- "Rust Analyzer test controller" ,
111
- ) ;
109
+ if ( this . config . testExplorer ) {
110
+ this . testController = vscode . tests . createTestController (
111
+ "rustAnalyzerTestController" ,
112
+ "Rust Analyzer test controller" ,
113
+ ) ;
114
+ }
112
115
this . workspace = workspace ;
113
116
this . clientSubscriptions = [ ] ;
114
117
this . commandDisposables = [ ] ;
115
118
this . commandFactories = commandFactories ;
116
119
this . unlinkedFiles = [ ] ;
117
120
this . state = new PersistentState ( extCtx . globalState ) ;
118
- this . config = new Config ( extCtx ) ;
119
121
120
122
this . updateCommands ( "disable" ) ;
121
123
this . setServerStatus ( {
@@ -126,7 +128,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
126
128
dispose ( ) {
127
129
this . config . dispose ( ) ;
128
130
this . statusBar . dispose ( ) ;
129
- this . testController . dispose ( ) ;
131
+ this . testController ? .dispose ( ) ;
130
132
void this . disposeClient ( ) ;
131
133
this . commandDisposables . forEach ( ( disposable ) => disposable . dispose ( ) ) ;
132
134
}
@@ -271,7 +273,9 @@ export class Ctx implements RustAnalyzerExtensionApi {
271
273
await client . start ( ) ;
272
274
this . updateCommands ( ) ;
273
275
274
- prepareTestExplorer ( this , this . testController , client ) ;
276
+ if ( this . testController ) {
277
+ prepareTestExplorer ( this , this . testController , client ) ;
278
+ }
275
279
if ( this . config . showDependenciesExplorer ) {
276
280
this . prepareTreeDependenciesView ( client ) ;
277
281
}
0 commit comments