aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-01-11 15:11:16 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-11 15:11:16 +0100
commit29afc301ea05bc907444b698c91b141c26167baa (patch)
tree63141257deab54705be8c937ef7f1c0b95b7512d /init.lua
parentf04bb93e982060ed27e5cf6e4a8d97edeb0910b6 (diff)
downloadvis-lspc-29afc301ea05bc907444b698c91b141c26167baa.tar.gz
vis-lspc-29afc301ea05bc907444b698c91b141c26167baa.zip
make universal root detection opt-in
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index f2d4f45..0cbbe99 100644
--- a/init.lua
+++ b/init.lua
@@ -1262,16 +1262,23 @@ end
local function find_root_uri(ls, file_path)
local globs = ''
- local roots = ls.roots
+ local roots = ls.conf.roots
if roots then
for _, glob in ipairs(roots) do
globs = globs .. glob .. '\n'
end
end
- globs = globs .. '.git\n.hg\n'
+ if lspc.universal_root_globs then
+ for _, glob in ipairs(lspc.universal_root_globs) do
+ globs = globs .. glob .. '\n'
+ end
+ end
local root_path = util.find_upwards(globs, file_path)
+ if not root_path and lspc.fallback_dirname_as_root then
+ root_path = util.dirname(file_path)
+ end
return root_path and path_to_uri(root_path)
end