fix(vim.fs): avoid fn.fnamemodify in fs.root #37162

Problem: vim.fs.root uses vim.fn.fnamemodify. vim.fn table isn't
available from nvim -ll or thread contexts.

Solution: Swap out vim.fn.fnamemodify for vim.fs.abspath.

This is a temporary workaround and may be reverted since the
long-term plan is to use more fast=true "fn" functions from vim.fs
where possible.
This commit is contained in:
Jason Shipman
2025-12-30 06:57:06 +00:00
committed by GitHub
parent 03377b9552
commit 825e182139

View File

@@ -450,8 +450,8 @@ function M.root(source, marker)
})
if #paths ~= 0 then
local dir = vim.fs.dirname(paths[1])
return dir and vim.fn.fnamemodify(dir, ':p:h') or nil
local dir = M.dirname(paths[1])
return dir and M.abspath(dir) or nil
end
end