simplified clangd setup
This commit is contained in:
parent
75add61c7f
commit
de83e49f90
|
@ -118,14 +118,22 @@ return {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
ft = M.clang_filetypes,
|
ft = M.clang_filetypes,
|
||||||
config = function()
|
config = function()
|
||||||
local dir = find_compile_commands()
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
if dir then
|
pattern = M.clang_filetypes,
|
||||||
vim.notify('[clangd] Starting with compile_commands from: ' .. dir)
|
group = vim.api.nvim_create_autocmd('clangd-setup', { clear = true }),
|
||||||
M.start_clangd(dir)
|
callback = function()
|
||||||
else
|
if not vim.lsp.get_clients({ name = 'clangd' })[1] then
|
||||||
vim.notify '[clangd] No compile_commands found. Using fallback config.\nUse <leader>cc to manually set location.'
|
local dir = find_compile_commands()
|
||||||
M.start_clangd(nil)
|
if dir then
|
||||||
end
|
vim.notify('[clangd] Starting with compile_commands from: ' .. dir)
|
||||||
|
M.start_clangd(dir)
|
||||||
|
else
|
||||||
|
vim.notify '[clangd] No compile_commands found. Using fallback config.\nUse <leader>cc to manually set location.'
|
||||||
|
M.start_clangd(nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' })
|
vim.keymap.set('n', '<leader>cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' })
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in New Issue