Closed half-potato closed 1 year ago
Looks like a bug in clangd
language server improperly handling document highlighting requests. This is not something AstroNvim can fix or handle at all, but you can disable the automatic document highlighting in your user configuration for the clangd
server until they fix their bugs. Something like this is an example user/init.lua
file:
return {
lsp = {
config = {
clangd = {
on_attach = function(client, bufnr)
local cmds_found, cmds =
pcall(vim.api.nvim_get_autocmds, { group = "lsp_document_highlight", buffer = bufnr })
if cmds_found then vim.tbl_map(function(cmd) vim.api.nvim_del_autocmd(cmd.id) end, cmds) end
end,
},
},
},
}
Or if you have a split up user configuration, you can just put this in the file user/lsp/config/clangd.lua
:
return {
on_attach = function(client, bufnr)
local cmds_found, cmds = pcall(vim.api.nvim_get_autocmds, { group = "lsp_document_highlight", buffer = bufnr })
if cmds_found then vim.tbl_map(function(cmd) vim.api.nvim_del_autocmd(cmd.id) end, cmds) end
end,
}
Checklist
:AstroUpdate
Operating system/version
ubuntu 20, Manjaro
Terminal/GUI
kitty
AstroNvim Health
astronvim: require("astronvim.health").check()
AstroNvim ~
git
is installed: Used for core functionality such as updater and plugin managementxdg-open
is installed: Used forgx
mapping for opening files with system opener (Optional)lazygit
is installed: Used for mappings to pull up git TUI (Optional)node
is installed: Used for mappings to pull up node REPL (Optional)gdu
is not installed: Used for mappings to pull up disk usage analyzer (Optional)btm
is not installed: Used for mappings to pull up system monitor (Optional)python
is installed: Used for mappings to pull up python REPL (Optional)Describe the bug
Clangd generates endless invalid AST errors when attached to a buffer that contains C++ code but does not have a typical C++ extension.
clangd version 15.0.7
Steps to Reproduce
Expected behavior
No repeated errors.
Screenshots
No response
Additional Context
No response