debugging watcher

This commit is contained in:
dlond 2025-05-30 04:56:46 +12:00
parent e11a8036d6
commit ec295c9438
1 changed files with 16 additions and 1 deletions

View File

@ -95,13 +95,28 @@ function M.watch_compile_commands(dir)
end
watcher:start(watch_path, { recursive = true }, function(err, fname, status)
vim.schedule(function()
print('[clangd] Watcher triggered: ', fname, vim.inspect(status))
end)
if err then
vim.schedule(function()
vim.notify('[clangd] Watcher error: ' .. err, vim.log.levels.ERROR)
end)
return
end
if fname then
vim.schedule(function()
vim.notify('[clangd] File triggered: ' .. fname)
end)
end
if fname and fname:match 'compile_commands%.json$' and status.change then
vim.schedule(function()
vim.notify '[clangd] Matched pattern for compile_commands.json'
end)
end
if fname and fname:match 'compile_commands%.json$' and status.change then
if debounce_timer then
debounce_timer.stop()