@@ -127,6 +127,9 @@ class WorkspaceFolderEntry {
127
127
}
128
128
}
129
129
130
+ const testExplorerIsEnabled = ( workspace : vscode . WorkspaceFolder ) =>
131
+ vscode . workspace . getConfiguration ( "robotcode.testExplorer" , workspace ) . get < boolean > ( "enabled" ) ;
132
+
130
133
export class TestControllerManager {
131
134
private _disposables : vscode . Disposable ;
132
135
public readonly testController : vscode . TestController ;
@@ -194,6 +197,17 @@ export class TestControllerManager {
194
197
( _ ) => undefined ,
195
198
) ;
196
199
} ) ,
200
+ vscode . workspace . onDidChangeConfiguration ( ( event ) => {
201
+ for ( const ws of vscode . workspace . workspaceFolders ?? [ ] ) {
202
+ if ( event . affectsConfiguration ( "robotcode.testExplorer" , ws ) ) {
203
+ if ( testExplorerIsEnabled ( ws ) ) {
204
+ this . refresh ( ) . catch ( ( _ ) => undefined ) ;
205
+ } else {
206
+ if ( ws ) this . removeWorkspaceFolderItems ( ws ) ;
207
+ }
208
+ }
209
+ }
210
+ } ) ,
197
211
vscode . workspace . onDidCloseTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
198
212
vscode . workspace . onDidSaveTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
199
213
vscode . workspace . onDidOpenTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
@@ -884,7 +898,7 @@ export class TestControllerManager {
884
898
const addedIds = new Set < string > ( ) ;
885
899
886
900
for ( const folder of vscode . workspace . workspaceFolders ?? [ ] ) {
887
- if ( token ?. isCancellationRequested ) return ;
901
+ if ( token ?. isCancellationRequested || ! testExplorerIsEnabled ( folder ) ) return ;
888
902
889
903
if ( this . robotTestItems . get ( folder ) === undefined || ! this . robotTestItems . get ( folder ) ?. valid ) {
890
904
const items = await this . getTestsFromWorkspaceFolder ( folder , token ) ;
0 commit comments