mirror of
https://github.com/neovim/neovim.git
synced 2026-01-03 18:06:29 +10:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user