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

Add a when clause to the contributed explorer view such that it is only activated when the workspace has a pom.xml file #549

Closed
tristan957 opened this issue Nov 6, 2020 · 5 comments · Fixed by #553
Labels
feature-request New feature or request
Milestone

Comments

@tristan957
Copy link

Describe the bug
The extension contributes its view when not in a Maven project. Currently in a Python project without anything to do with Java and I see the view contribution.

To Reproduce
Steps to reproduce the behavior:

  1. Open a non-java, non-maven project
  2. See view is contributed

Expected behavior
Don't show view when not in a Maven project (no pom.xml).

Environments (please complete the following information as much as possible):

  • OS: Windows 10
  • VS Code version: 1.51
  • Extension version: 0.25.0

Additional context
https://github.com/microsoft/vscode-maven/blob/master/package.json#L191
microsoft/vscode-java-test#793
microsoft/vscode-java-test#793 (comment)
microsoft/vscode-java-dependency#372

@tristan957
Copy link
Author

Would it also be possible to add a name, contextualTitle, and icon? these would greatly benefit people who move the view into the Activity Bar like myself.

https://code.visualstudio.com/api/references/contribution-points#contributes.views

@Eskibear
Copy link
Member

Don't show view when not in a Maven project (no pom.xml).

We used to do that, but later we decided to always show it. We received feedbacks from users (new to vscode) that they don't know how to start from scratch (e.g. create a maven project). The shortcut button (+) in the view proves to be helpful.
For the moment, you can right click and hide the view by your own.

But I do agree that if you are focusing on a non-java project(e.g. Python), it shouldn't bother you. My rough idea now is:

  • if no folder/workspace is open, always show the view. So we can help those beginners start from scratch.

  • if a non-java project is open (e.g. no pom.xml in workspace), we don't show the view, until you explicitly activate the extension. We should always provide users with an option to show the view if they want to. E.g. for users working on polyglot projects.

@Eskibear Eskibear added the feature-request New feature or request label Nov 10, 2020
@tristan957
Copy link
Author

Could there be a setting for advanced users such that we only see the view when a pom.xml exists? Or maybe just restrict to showing the view when there are java files in the workspace? Be less restrictive than looking explicitly for a pom.xml, which would maybe get the best of both worlds since users could create a maven project now that view is there, and advanced users wouldn't see it in non-java projects.

@tristan957
Copy link
Author

@Eskibear if I want to also get #549 (comment) resolved, should I make a separate ticket?

Thanks for implementing at least the when clause! Very helpful!

@Eskibear
Copy link
Member

I'm fixing it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants