Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow test extensions to activate when test view is shown #132395

Closed
hbenl opened this issue Sep 5, 2021 · 4 comments
Closed

Allow test extensions to activate when test view is shown #132395

hbenl opened this issue Sep 5, 2021 · 4 comments
Assignees
Labels
testing Built-in testing support under-discussion Issue is under discussion for relevance, priority, approach

Comments

@hbenl
Copy link

hbenl commented Sep 5, 2021

This came up in hbenl/vscode-test-explorer#226, but it is equally relevant for test extensions that use the native testing API directly.
It could make sense for test extensions to only activate when the user opens the test view (or calls a test command etc.) to save resources during VS Code startup. However with the native testing API this turns into a chicken-and-egg problem: the test icon (for opening the test view) isn't shown until the testing extension is activated, and the extension isn't activated until the test icon is clicked.
Perhaps VS Code could check if there is an installed extension that activates on onView:workbench.view.testing and always show the test icon in that case. Alternatively, a setting for making the test icon permanently visible (similar to testExplorer.hideWhen) could be used.

@connor4312
Copy link
Member

Tests may be required at other times aside from when the test explorer view is open. For example, when users open a file, or when they simply issue the "run all tests" even if no testing view or files are open. Also, if no tests controllers are registered, we don't show the testing view at the moment. We recommend that extensions use workspaceContains activation event to activate if they suspect tests may be present.

@connor4312 connor4312 added testing Built-in testing support under-discussion Issue is under discussion for relevance, priority, approach labels Sep 7, 2021
@connor4312
Copy link
Member

connor4312 commented Nov 4, 2021

I don't think it's appropriate to add an activation event here since test are often needed without the view being visible. For example, I use testing but rarely open the test explorer and rely solely on keybindings and gutter actions.

@matepek
Copy link

matepek commented Nov 4, 2021

When is the root item’s resolvHandler called? At “open” of test view?

@connor4312
Copy link
Member

Yes, that's one case. Or any time the editor needs items from the tree. For example, if the user reloads the window and runs "rerun last" or "rerun failed", then the editor will resolve items so that it can pass them to the runHandler

@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
testing Built-in testing support under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

3 participants