chore(watchers): refactor events and make debouncer safe

- fs poll -> fs events
- make debouncer safe and fix diagnostics events
This commit is contained in:
Alexander Courtis
2022-07-17 16:50:24 +10:00
committed by GitHub
parent 26512c369f
commit 06e48c29c4
12 changed files with 155 additions and 82 deletions

View File

@@ -29,8 +29,8 @@ function M.reload_project(project_root, path)
return
end
if path and not path:match("^" .. project_root) then
path = nil
if path and path:find(project_root, 1, true) ~= 1 then
return
end
local git_status = Runner.run {
@@ -43,7 +43,7 @@ function M.reload_project(project_root, path)
if path then
for p in pairs(project.files) do
if p:match("^" .. path) then
if p:find(path, 1, true) == 1 then
project.files[p] = nil
end
end
@@ -138,10 +138,6 @@ function M.load_project_status(cwd)
reload_tree_at(opts.project_root)
end)
end,
on_event0 = function()
log.line("watcher", "git event")
M.reload_tree_at(project_root)
end,
}
end