fix(explorer.watch): handle systems where fs_event doesn't return file names. Closes #2190. Closes #2032
Some checks are pending
CI / ci (push) Waiting to run

This commit is contained in:
Folke Lemaitre 2025-10-19 12:13:18 +02:00
parent 9d967bd02a
commit d6e34b158d
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -16,11 +16,12 @@ function M.start(path, cb)
end
local handle = assert(vim.uv.new_fs_event())
local ok, err = handle:start(path, {}, function(_, file, events)
file = path .. "/" .. file
if cb then
cb(file, events)
-- Handle nil filename (FreeBSD kqueue bug where filename may be unavailable)
-- In that case, we just pass the path being watched
cb(file and (path .. "/" .. file) or path, events)
else
Tree:refresh(vim.fs.dirname(file))
Tree:refresh(path)
M.refresh()
end
end)