From 386cb4d2fff3f3412c7dbf8f8c6df63f09fa8853 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 04:48:00 +1200 Subject: [PATCH] try watch compile_config --- lua/custom/plugins/lsp/clangd.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 16a78ed4..77c77b59 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -95,6 +95,7 @@ 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)) if err then vim.schedule(function() vim.notify('[clangd] Watcher error: ' .. err, vim.log.levels.ERROR) @@ -110,8 +111,8 @@ function M.watch_compile_commands(dir) debounce_timer:start(200, 0, function() vim.schedule(function() vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' - -- M.start_clangd(watch_path) - M.reload_clangd() + watcher:stop() + M.start_clangd(vim.fn.fnamemodify(fname, ':h') end) end) end