mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
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
Some checks are pending
CI / ci (push) Waiting to run
This commit is contained in:
parent
9d967bd02a
commit
d6e34b158d
1 changed files with 4 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue