@@ -127,6 +127,9 @@ class WorkspaceFolderEntry {
127127 }
128128}
129129
130+ const testExplorerIsEnabled = ( workspace : vscode . WorkspaceFolder ) =>
131+ vscode . workspace . getConfiguration ( "robotcode.testExplorer" , workspace ) . get < boolean > ( "enabled" ) ;
132+
130133export class TestControllerManager {
131134 private _disposables : vscode . Disposable ;
132135 public readonly testController : vscode . TestController ;
@@ -194,6 +197,17 @@ export class TestControllerManager {
194197 ( _ ) => undefined ,
195198 ) ;
196199 } ) ,
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+ } ) ,
197211 vscode . workspace . onDidCloseTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
198212 vscode . workspace . onDidSaveTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
199213 vscode . workspace . onDidOpenTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
@@ -884,7 +898,7 @@ export class TestControllerManager {
884898 const addedIds = new Set < string > ( ) ;
885899
886900 for ( const folder of vscode . workspace . workspaceFolders ?? [ ] ) {
887- if ( token ?. isCancellationRequested ) return ;
901+ if ( token ?. isCancellationRequested || ! testExplorerIsEnabled ( folder ) ) return ;
888902
889903 if ( this . robotTestItems . get ( folder ) === undefined || ! this . robotTestItems . get ( folder ) ?. valid ) {
890904 const items = await this . getTestsFromWorkspaceFolder ( folder , token ) ;
0 commit comments