chore(watchers): refactor events and make debouncer safe
- fs poll -> fs events - make debouncer safe and fix diagnostics events
This commit is contained in:
committed by
GitHub
parent
26512c369f
commit
06e48c29c4
@@ -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
|
||||
|
||||
|
||||
@@ -147,11 +147,11 @@ function Runner.run(opts)
|
||||
log.profile_end(ps, "git job %s %s", opts.project_root, opts.path)
|
||||
|
||||
if self.rc == -1 then
|
||||
log.line("git", "job timed out")
|
||||
log.line("git", "job timed out %s %s", opts.project_root, opts.path)
|
||||
elseif self.rc ~= 0 then
|
||||
log.line("git", "job failed with return code %d", self.rc)
|
||||
log.line("git", "job fail rc %d %s %s", self.rc, opts.project_root, opts.path)
|
||||
else
|
||||
log.line("git", "job success")
|
||||
log.line("git", "job success %s %s", opts.project_root, opts.path)
|
||||
end
|
||||
|
||||
return self.output
|
||||
|
||||
Reference in New Issue
Block a user