Skip to content

Commit 9a8a635

Browse files
committed
Merge branch 'DetachHead-disable-testview'
2 parents 4fab1d1 + 5885fa5 commit 9a8a635

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,12 @@
428428
"default": true,
429429
"markdownDescription": "Enable/disable inlay hints for namespaces.",
430430
"scope": "resource"
431+
},
432+
"robotcode.testExplorer.enabled": {
433+
"type": "boolean",
434+
"default": true,
435+
"description": "Whether to show robot tests in the test explorer. You may want to disable this if you are using another tool to run robot tests.",
436+
"scope": "resource"
431437
}
432438
}
433439
},

vscode-client/testcontrollermanager.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -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+
130133
export 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

Comments
 (0)