From 54b59756d886e1512f0037bcd86bff65a463ef4a Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 20:38:52 +1200 Subject: [PATCH] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 12b34224..bb001983 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -37,15 +37,13 @@ function M.start_clangd(dir) '--query-driver=' .. vim.fn.exepath 'clang++', '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], } - if dir and dir ~= '' then - vim.notify('[clangd] Setting up with: ' .. dir) - table.insert(cmd, '--compile-commands-dir=' .. dir) - M.watch_compile_commands(dir) - else + if not dir or dir == '' then vim.notify '[clangd] Could not find compile_commands.json.\nUse lc to manually set location when available.' - vim.notify '[clangd] Setting up with: "."' - table.insert(cmd, '--compile-commands-dir="."') + dir = '.' end + vim.notify('[clangd] Setting up with: ' .. dir) + table.insert(cmd, '--compile-commands-dir=' .. dir) + M.watch_compile_commands(dir) print(vim.inspect(cmd)) lspconfig.clangd.setup {