mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 08:07:49 +00:00
Source and Test roots marked in Project Structure never reached jdtls, so projects without Maven, Gradle or Eclipse metadata relied on jdtls's inference. That inference could treat a package directory as the source root, which gave wrong-package and unresolved-import errors in the editor and in Run. Marked roots now go to jdtls as `java.project.sourcePaths`. Unmarked projects use `src/main/java` and `src/test/java`, or `src`; other layouts keep the inference. Changing the roots restarts only jdtls, with a separate workspace per source model, because a cached invisible project does not pick up new folders. Maven, Gradle and Eclipse projects keep their own model. Ant layouts count as unmanaged, since jdtls has no Ant importer. Settings sent to jdtls are now merged the same way for initialization, configuration requests and change notifications. A Run with no editor open finds a trigger file inside the source roots so the project still imports.
54 lines
2.5 KiB
TOML
54 lines
2.5 KiB
TOML
id = "java"
|
||
name = "Java"
|
||
extensions = ["java"]
|
||
line-comment = "//"
|
||
block-comment = ["/*", "*/"]
|
||
indent = { tab-size = 4, insert-spaces = true }
|
||
ui-mode = "Java"
|
||
tree-sitter = "java"
|
||
|
||
# Microsoft java-debug runs inside jdtls as a bundle (`initializationOptions.bundles`,
|
||
# added when installed); sessions start with `vscode.java.startDebugSession` and the
|
||
# client connects to the returned port (`debugServer`).
|
||
[debugger]
|
||
adapter = "java-debug"
|
||
command = "com.microsoft.java.debug.plugin.jar"
|
||
transport = "tcp"
|
||
install-hint = "Install Microsoft java-debug (Settings › Languages & Frameworks › Language Servers › Java Debugger)"
|
||
|
||
[[language-servers]]
|
||
name = "jdtls"
|
||
command = "jdtls"
|
||
root-markers = ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts", "build.xml", ".project"]
|
||
install-hint = "Install Eclipse JDT Language Server (brew install jdtls, or https://github.com/eclipse-jdtls/eclipse.jdt.ls); requires JDK 21+"
|
||
|
||
[language-servers.initialization-options]
|
||
bundles = []
|
||
|
||
[language-servers.initialization-options.extendedClientCapabilities]
|
||
# Library classes open as `jdt://` virtual documents (`java/classFileContents`).
|
||
classFileContentsSupport = true
|
||
resolveAdditionalTextEditsSupport = true
|
||
|
||
[language-servers.initialization-options.settings.java]
|
||
autobuild = { enabled = true }
|
||
contentProvider = { preferred = "fernflower" }
|
||
maven = { downloadSources = true, updateSnapshots = false }
|
||
eclipse = { downloadSources = true }
|
||
references = { includeDecompiledSources = true }
|
||
signatureHelp = { enabled = true }
|
||
configuration = { updateBuildConfiguration = "automatic" }
|
||
project = { referencedLibraries = ["lib/**/*.jar"] }
|
||
# Generated code (implement methods, getters, toString…) indents like the editor (`indent` above).
|
||
format = { insertSpaces = true, tabSize = 4 }
|
||
# Calls complete as `name()` with the caret inside and parameter info, not guessed arguments;
|
||
# JDK internals (`sun.*`, `com.sun.*`, `jdk.*`) and AWT's `List` stay out of completion and auto-import.
|
||
completion = { guessMethodArguments = "off", filteredTypes = ["java.awt.List", "com.sun.*", "sun.*", "jdk.*", "org.graalvm.*", "io.micrometer.shaded.*"] }
|
||
|
||
[language-servers.initialization-options.settings.java.import]
|
||
# Keep Eclipse metadata (.project, .classpath, .settings) out of the project.
|
||
generatesMetadataFilesAtProjectRoot = false
|
||
exclusions = ["**/node_modules/**", "**/.metadata/**", "**/archetype-resources/**", "**/META-INF/maven/**"]
|
||
maven = { enabled = true }
|
||
gradle = { enabled = true, wrapper = { enabled = true } }
|