The clangd LSP client won’t start when I open a C++ file.
I’m using the latest version of the nvim-lspconfig plugin (974d15fa2809dff691d6a50a6759bf2c8bf39b4a) and the nightly version of neovim (NVIM v0.6.0-dev+254-g413e86869). This is running on Windows 10.
I’ve verified that compile_commands.json is in the root directory of my project, and that there are no other plugins enabled except for nvim-lspconfig. I’ve also reduced my LSP config to the following to ensure that everything is using the defaults.
lua << EOF
vim.lsp.set_log_level("debug")
require('lspconfig').clangd.setup {}
EOF
When I open a C++ file with this config or start the client with :LspStart, I see the following from :LspInfo.
Language client log: D:\temp/nvim\lsp.log
Detected filetype: cpp
0 client(s) attached to this buffer:
Other clients that match the filetype: cpp
Config: clangd
filetypes: c, cpp, objc, objcpp
root directory: M:/src/llvm-project
cmd: clangd --background-index
cmd is executable: true
autostart: true
custom handlers: Configured servers list: clangd
One odd thing to note: objcpp is green in this dialog. Seems odd, given that the detected filetype is cpp.
The LSP logs only show this line, once per init.
[ START ] 2021-09-12T16:25:29-0700 ] LSP logging initiated
Lastly, I’ve verified that clangd can be executed in the editor.
:!clangd --version
clangd version 12.0.0
Any debugging suggestions would be appreciated.