From 825e182139ee230373a965dbfd135f874ef08d5a Mon Sep 17 00:00:00 2001 From: Jason Shipman Date: Tue, 30 Dec 2025 06:57:06 +0000 Subject: [PATCH] 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. --- runtime/lua/vim/fs.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua index fe3b08c8ad..4baa6b02db 100644 --- 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