microsoft / vscode-java-pack

VS Code extensions for Java developers.
Other
283 stars 124 forks source link

Should support polyglot projects better #874

Open testforstephen opened 2 years ago

testforstephen commented 2 years ago

Java projects are not automatically detected when a polyglot project is opened in VS Code. For example, microservice app (e.g. https://github.com/elgris/microservice-app-example) usually places each service into a separate folder, see the structure below. Since the root folder doesn't have any build file, Java extensions are not be activated automatically. Every time users have to open a Java file before using any Java feature, which is not convenient.

microservice
├── frontend
│   ...
│   └── package.json
├── backend
│   ...
│   └── pom.xml
└── README

To support polyglot project better, we can relax the activation event a little bit. For example, allow detection of build files from direct subfolders. VS Code activation events support glob pattern, which we can implement using workspaceContains:*/pom.xml. The glob pattern */pom.xml only scans two levels of directories and doesn't add much scanning cost.

    "workspaceContains:*/pom.xml",
    "workspaceContains:*/build.gradle",
    "workspaceContains:*/settings.gradle",
    "workspaceContains:*/build.gradle.kts",
    "workspaceContains:*/settings.gradle.kts",

This feature request applies to all Java extensions under Java pack.

Eskibear commented 2 years ago

Agree to optimize for such scenarios.

FYI vscode-maven is using "workspaceContains:**/pom.xml" (pom file at all levels) because activating it is not expensive, and it doesn't depend on any other extension. So I don't see action to take for maven extension.