backport: feat(vim.fs): vim.fs.root() can control priority #34413

feat(vim.fs): vim.fs.root() can control priority

Adds the capability of controlling the priority of searched markers in
vim.fs.root() by nesting lists.

(cherry picked from commit 0f0b96dd0f)
This commit is contained in:
Siddhant Agarwal
2025-06-10 07:19:51 -07:00
committed by GitHub
parent 718b3ffe74
commit 5d0766ddce
5 changed files with 80 additions and 21 deletions
+1 -7
View File
@@ -708,13 +708,7 @@ function lsp.start(config, opts)
validate('root_markers', opts._root_markers, 'table')
config = vim.deepcopy(config)
for _, marker in ipairs(opts._root_markers) do
local root = vim.fs.root(bufnr, marker)
if root ~= nil then
config.root_dir = root
break
end
end
config.root_dir = vim.fs.root(bufnr, opts._root_markers)
end
if