Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,12 @@
"default": true,
"markdownDescription": "Enable/disable inlay hints for namespaces.",
"scope": "resource"
},
"robotcode.testExplorer.enabled": {
"type": "boolean",
"default": true,
"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.",
"scope": "resource"
}
}
},
Expand Down
16 changes: 15 additions & 1 deletion vscode-client/testcontrollermanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ class WorkspaceFolderEntry {
}
}

const testExplorerIsEnabled = (workspace: vscode.WorkspaceFolder) =>
vscode.workspace.getConfiguration("robotcode.testExplorer", workspace).get<boolean>("enabled");

export class TestControllerManager {
private _disposables: vscode.Disposable;
public readonly testController: vscode.TestController;
Expand Down Expand Up @@ -194,6 +197,17 @@ export class TestControllerManager {
(_) => undefined,
);
}),
vscode.workspace.onDidChangeConfiguration((event) => {
for (const ws of vscode.workspace.workspaceFolders ?? []) {
if (event.affectsConfiguration("robotcode.testExplorer", ws)) {
if (testExplorerIsEnabled(ws)) {
this.refresh().catch((_) => undefined);
} else {
if (ws) this.removeWorkspaceFolderItems(ws);
}
}
}
}),
vscode.workspace.onDidCloseTextDocument((document) => this.refreshDocument(document)),
vscode.workspace.onDidSaveTextDocument((document) => this.refreshDocument(document)),
vscode.workspace.onDidOpenTextDocument((document) => this.refreshDocument(document)),
Expand Down Expand Up @@ -884,7 +898,7 @@ export class TestControllerManager {
const addedIds = new Set<string>();

for (const folder of vscode.workspace.workspaceFolders ?? []) {
if (token?.isCancellationRequested) return;
if (token?.isCancellationRequested || !testExplorerIsEnabled(folder)) return;

if (this.robotTestItems.get(folder) === undefined || !this.robotTestItems.get(folder)?.valid) {
const items = await this.getTestsFromWorkspaceFolder(folder, token);
Expand Down