From ec295c9438fc07dc4cc6d2eaea694535ebf47488 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 04:56:46 +1200 Subject: [PATCH] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index c5f43217..2707eea5 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -95,13 +95,28 @@ function M.watch_compile_commands(dir) end watcher:start(watch_path, { recursive = true }, function(err, fname, status) - print('[clangd] Watcher triggered: ', fname, vim.inspect(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()