From 220864faf2a407534f4987f037b459c1cf3f79b8 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 08:05:56 +1200 Subject: [PATCH] fix: testing revealed errors --- lua/plugins/config/compile-commands-picker.lua | 9 ++++++++- lua/plugins/config/lsp/init.lua | 3 --- lua/plugins/spec/telescope.lua | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index bc7c5c86..cabe87c1 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -90,7 +90,14 @@ CompileFlags: local clients = vim.lsp.get_active_clients({ name = 'clangd' }) if #clients > 0 then vim.notify('Restarting clangd...', vim.log.levels.INFO) - vim.cmd('LspRestart clangd') + -- Stop and start clangd to pick up new config + for _, client in ipairs(clients) do + client.stop() + end + vim.defer_fn(function() + vim.cmd('LspStart clangd') + vim.notify('Clangd restarted with new configuration', vim.log.levels.INFO) + end, 100) end else vim.notify('Failed to create .clangd file', vim.log.levels.ERROR) diff --git a/lua/plugins/config/lsp/init.lua b/lua/plugins/config/lsp/init.lua index fab3e1d8..930dd4a4 100644 --- a/lua/plugins/config/lsp/init.lua +++ b/lua/plugins/config/lsp/init.lua @@ -21,9 +21,6 @@ function M.setup() -- Setup LSP keymaps require('plugins.config.lsp.keymaps').setup() - - -- Setup compile_commands.json picker for C/C++ projects - require('plugins.config.compile-commands-picker').setup() end return M \ No newline at end of file diff --git a/lua/plugins/spec/telescope.lua b/lua/plugins/spec/telescope.lua index 383c5e84..e6759e6d 100644 --- a/lua/plugins/spec/telescope.lua +++ b/lua/plugins/spec/telescope.lua @@ -17,5 +17,7 @@ return { }, config = function() require('plugins.config.telescope').setup() + -- Setup compile_commands.json picker for C/C++ projects + require('plugins.config.compile-commands-picker').setup() end, } \ No newline at end of file