Skip to content

Commit

Permalink
add option to disable test view
Browse files Browse the repository at this point in the history
  • Loading branch information
DetachHead committed Oct 25, 2023
1 parent 39487c7 commit 4d6ad08
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions robotframework-ls/codegen/settings.py
Expand Up @@ -259,6 +259,11 @@
"default": 40,
"description": "This is the timeout used for listing the tests from a robot file. Set to 0 to disable it.",
},
"robot.testView.enabled": {
"type": "boolean",
"default": True,
"description": "Whether to show robot tests in the test view. You may want to disable this if you are using another test runner (eg. https://github.com/DetachHead/pytest-robotframework)",
},
}


Expand Down
5 changes: 5 additions & 0 deletions robotframework-ls/package.json
Expand Up @@ -700,6 +700,11 @@
"type": "number",
"default": 40,
"description": "This is the timeout used for listing the tests from a robot file. Set to 0 to disable it."
},
"robot.testView.enabled": {
"type": "boolean",
"default": true,
"description": "Whether to show robot tests in the test view. You may want to disable this if you are using another test runner (eg. https://github.com/DetachHead/pytest-robotframework)"
}
}
},
Expand Down
9 changes: 6 additions & 3 deletions robotframework-ls/vscode-client/src/testview.ts
Expand Up @@ -39,13 +39,15 @@ export interface ITestInfoFromUri {
testInfo: ITestInfoFromSymbolsCache[];
}

const controller = vscode.tests.createTestController("robotframework-lsp.testController", "Robot Framework");
const controller = vscode.workspace.getConfiguration("robot.testView").get<boolean>("enabled")
? vscode.tests.createTestController("robotframework-lsp.testController", "Robot Framework")
: undefined;

const runProfile = controller.createRunProfile("Run", vscode.TestRunProfileKind.Run, (request, token) => {
const runProfile = controller?.createRunProfile("Run", vscode.TestRunProfileKind.Run, (request, token) => {
runHandler(false, request, token);
});

const debugProfile = controller.createRunProfile("Debug", vscode.TestRunProfileKind.Debug, (request, token) => {
const debugProfile = controller?.createRunProfile("Debug", vscode.TestRunProfileKind.Debug, (request, token) => {
runHandler(true, request, token);
});

Expand All @@ -67,6 +69,7 @@ export const DEBUG_PROFILE = debugProfile;
// };

export async function clearTestItems() {
if (!controller) return;
controller.items.replace([]);
testItemIdToTestItem.clear();
}
Expand Down

0 comments on commit 4d6ad08

Please sign in to comment.