try watch compile_config
This commit is contained in:
parent
b2038d3788
commit
381206c8f2
|
@ -124,12 +124,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('BufReadPost', {
|
||||||
M.start_clangd(dir)
|
group = vim.api.nvim_create_augroup('clangd-lazy-init', { clear = true }),
|
||||||
if dir ~= '' then
|
pattern = '*',
|
||||||
M.watch_compile_commands(dir)
|
callback = function(args)
|
||||||
end
|
local ft = vim.bo[args.buf].filetype
|
||||||
|
if vim.tbl_contains(M.clang_filetypes, ft) then
|
||||||
|
local dir = find_compile_commands()
|
||||||
|
M.start_clangd(dir)
|
||||||
|
if dir ~= '' then
|
||||||
|
M.watch_compile_commands(dir)
|
||||||
|
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' })
|
||||||
|
vim.api.nvim_clear_autocmds { group = 'clangd-lazy-init' }
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue