eclipse.jdt.ls icon indicating copy to clipboard operation
eclipse.jdt.ls copied to clipboard

Need more predictable import behavior

Open guw opened this issue 3 years ago • 0 comments

JDT LS relies on importing projects into a workspace. This works fine for small-ish projects following conventions. However, it gets more complicated when a project is found with multiple different build types (eg. pom.xml and Gradle files).

The current state is confusing:

  • In VS Code it's possible to disable Maven/Gradle importer via VS Code specific settings file.
  • There seems to be additional support in VS Code settings file to tweak import behavior (eg., java.import.exclusions).
  • There is a PDE extension which started to create its own javaConfig.json file to "configure" the importer.
  • We have a similar need in our Bazel JDT LS extension and dislike the idea of starting yet another config file.
  • I have not yet discovered what java.configuration.updateBuildConfiguration does.

It would be great if JDT LS had a way to provide a file in the source code tree that has import instructions for JDT LS. This would work across different IDEs/editors because it's a concept of JDT LS. It could also "warn" any extension that a specific importer (eg., PDE/Bazel) is missing.

Proposal:

  • Add support for reading .settings/java.json (same syntax/format as VS Code settings.json)
  • Make parsed settings from .settings/java.json available to importers during import
  • Add importer definition/pre-selection capability to .settings/java.json
  • Add existing import tweaks to .settings/java.json

Questions:

  • [ ] .settings/ or .eclipse/?

guw avatar Nov 20 '21 15:11 guw