-
Notifications
You must be signed in to change notification settings - Fork 130
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
the Test Explorer is present outside java projects #793
Comments
@jdneo are there any updates on this issue since you last commented. |
@tristan957 Not yet, we are kind of watching if there are more votes. If more votes are coming we will prioritize it. |
I would be interested in submitting a PR just because I find it so annoying. Would you be able to provide guidance if I have questions? |
@tristan957 How about hiding the icon by right-click the sidebar? |
Not a good solution for me because I some times work in Java environments and I don't want to have to manually remember that kind of thing |
I see. So instead of just hiding the explorer. I think we can have a welcome view to help new users know how to start with using the extension (or something else about guidance, to make it more useful). Meanwhile, maybe a setting can also be added to determine whether to show it or not. I'll update here once I have a more concrete idea. Thanks |
I mean I don't think it has to be a setting. The CMake Tools extension from Microsoft only activates and shows sidebar icon if there is a CMakelists.txt in your workspace. I just think this extension could do something similar like "if no java files, and no tests" don't show, or even just "if no java files". |
yeah I completely agree. I quickly searched through the vscode-python extension and it looks like they use this value in the when clause of the the https://github.com/microsoft/vscode-python/search?q=%22testsDiscovered%27%2C+true%22 By glancing through the vscode extension documentation I believe they're using this feature specifically: https://code.visualstudio.com/api/extension-guides/command#using-a-custom-when-clause-context so a basic implementation of what they're doing would be imo to search for the presence of java files in the current workspace, maybe even of a "test" folder under src, which i believe is an accepted standard for the language, and if the search is successful add a custom when clause context: vscode.commands.executeCommand('setContext', 'vscode-java-test:javaTestsDiscovered', true); Then modify these lines Lines 67 to 74 in e2f930a
to: "views": {
"test": [
{
"id": "testExplorer",
"name": "Java",
"when": "vscode-java-test:javaTestsDiscovered"
}
]
}, or something like that. Maybe the scoping "vscode-java-test" is unnecessary. |
@erclu do you also have https://github.com/Microsoft/vscode-java-dependency and https://github.com/Microsoft/vscode-maven installed? They also show their views all the time. Thinking about making issues there as well along the same lines, |
I have them but tbh I usually keep all my extensions globally disabled and enable them for the workspaces they're needed in so I'm not impacted by this issue as much anymore. But yeah go ahead! I think it may also be worth to open an issue for vscode itself to suggest they increase the visibility of that section of the documentation, because it does look like a lot of extensions do not implement this feature adequately. |
Yea all the extensions I have trouble with regarding this issue are actually all Microsoft-authored which is funny. I am opening all the issues against those extensions right now. Thanks for the effort you put into your previous comment. Easy to link to so that other extension maintainers can easily read how to use the feature. |
New behavior: won't show the explorer if the extension is not activated, which will be available in the next release. More details can be found in #1110 |
VSCode Version: 1.37.1 (system setup)
Java Test Runner Version: 0.19.0
OS: Windows_NT x64 10.0.18362
Apologies if it's a known issue, i couldn't find any similar ones.
The behavior i was expecting was for the java text explorer to be shown only in java projects (or, equivalently, after opening a java file), but on my system whenever the extension is not completely disabled the sidebar panel is visible and accessible.
This is not consistent with the behavior of other testing extensions (e.g. microsoft/vscode-python).
Might I also suggest to change the name shown in the panel from "Test Explorer" to something more java specific?
The text was updated successfully, but these errors were encountered: