commit 825e182139ee230373a965dbfd135f874ef08d5a
parent 03377b95523324a2a1657435f12c13a493ee5360
Author: Jason Shipman <jasonpshipman@gmail.com>
Date: Tue, 30 Dec 2025 06:57:06 +0000
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.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua
@@ -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