-
-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathroot.lua
More file actions
29 lines (25 loc) · 870 Bytes
/
root.lua
File metadata and controls
29 lines (25 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
local M = {}
local root_markers1 = {
-- Multi-module projects
'mvnw', -- Maven
'gradlew', -- Gradle
'settings.gradle', -- Gradle
'settings.gradle.kts', -- Gradle
-- 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
'build.gradle', -- Gradle
'build.gradle.kts', -- Gradle
}
function M.get_root_markers()
return vim.fn.has('nvim-0.11.3') == 1 and { root_markers1, root_markers2 }
or vim.list_extend(root_markers1, root_markers2)
end
return M