aboutsummaryrefslogtreecommitdiffstats
path: root/lsp
diff options
context:
space:
mode:
authorTomas Slusny <slusnucky@gmail.com>2025-09-29 23:28:11 +0200
committerGitHub <noreply@github.com>2025-09-29 14:28:11 -0700
commite978b3bf11bcc2663f80b11b606c5b6762ce503d (patch)
tree6ac47a4aa344ef2203ff8065415f29bda996fae2 /lsp
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-e978b3bf11bcc2663f80b11b606c5b6762ce503d.tar
nvim-lspconfig-e978b3bf11bcc2663f80b11b606c5b6762ce503d.tar.gz
nvim-lspconfig-e978b3bf11bcc2663f80b11b606c5b6762ce503d.tar.bz2
nvim-lspconfig-e978b3bf11bcc2663f80b11b606c5b6762ce503d.tar.lz
nvim-lspconfig-e978b3bf11bcc2663f80b11b606c5b6762ce503d.tar.xz
nvim-lspconfig-e978b3bf11bcc2663f80b11b606c5b6762ce503d.tar.zst
nvim-lspconfig-e978b3bf11bcc2663f80b11b606c5b6762ce503d.zip
fix(jdtls): increase priority of ".git", add "mvnw", "gradlew" #4104
Using git directory as last resort before defaulting to pom.xml is important for multi module maven projects. Example of structure: pom.xml submodule-a/pom.xml submodule-b/pom.xml If sumbodule-b depends on submodule-a (common pattern for dto/impl), the parent usually has info about linking the 2 projects (and without that go to definition etc will jump to compiled source that might not be present/up t date). This structure is also fine and do not breaks jdtls: my-project/pom.xml e.g its fine if working directory is git repo root (and this pattern is also much less common than multi module maven projects that without this change break always). Closes #4102 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
Diffstat (limited to 'lsp')
-rw-r--r--lsp/jdtls.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/lsp/jdtls.lua b/lsp/jdtls.lua
index cfd32aaf..728f5907 100644
--- a/lsp/jdtls.lua
+++ b/lsp/jdtls.lua
@@ -65,17 +65,23 @@ end
local root_markers1 = {
-- Multi-module projects
+ 'mvnw',
+ 'gradlew',
'build.gradle',
'build.gradle.kts',
+ -- Use git directory as last resort for multi-module maven projects
+ -- In multi-module maven projects it is not really possible to determine what is the parent directory
+ -- and what is submodule directory. And jdtls does not break if the parent directory is at higher level than
+ -- actual parent pom.xml so propagating all the way to root git directory is fine
+ '.git',
+}
+local root_markers2 = {
-- Single-module projects
'build.xml', -- Ant
'pom.xml', -- Maven
'settings.gradle', -- Gradle
'settings.gradle.kts', -- Gradle
}
-local root_markers2 = {
- '.git',
-}
---@type vim.lsp.Config
return {