lazy clangd

This commit is contained in:
dlond 2025-05-30 20:38:52 +12:00
parent 5d94528f6e
commit 54b59756d8
1 changed files with 5 additions and 7 deletions

View File

@ -37,15 +37,13 @@ function M.start_clangd(dir)
'--query-driver=' .. vim.fn.exepath 'clang++', '--query-driver=' .. vim.fn.exepath 'clang++',
'--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1],
} }
if dir and dir ~= '' then if not dir or dir == '' then
vim.notify('[clangd] Setting up with: ' .. dir)
table.insert(cmd, '--compile-commands-dir=' .. dir)
M.watch_compile_commands(dir)
else
vim.notify '[clangd] Could not find compile_commands.json.\nUse <leader>lc to manually set location when available.' vim.notify '[clangd] Could not find compile_commands.json.\nUse <leader>lc to manually set location when available.'
vim.notify '[clangd] Setting up with: "."' dir = '.'
table.insert(cmd, '--compile-commands-dir="."')
end end
vim.notify('[clangd] Setting up with: ' .. dir)
table.insert(cmd, '--compile-commands-dir=' .. dir)
M.watch_compile_commands(dir)
print(vim.inspect(cmd)) print(vim.inspect(cmd))
lspconfig.clangd.setup { lspconfig.clangd.setup {