Clangd LSP client won't start

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.

Revert back to 0.5, there’s a bug with URIs on the nightly

Hmmm… Thanks for the quick reply. Unfortunately, 0.5 shows the same behavior.

Updated to 0.5.1 and still see the same behavior. Any suggestions for debugging would be appreciated. Unfortunately, I’m not quite sure where to start when working with these lua plugins.

The URI issue is only fixed on the nightly

Will definitely give that a try. Are there nightly binaries available? Couldn’t find them on the release page.

Reproduced the issue on master (NVIM v0.6.0-dev+513-ga5d6f36fc).

I don’t know then, seems to be something with your local environment. I’m using clangd on Windows and don’t have an issue using the minimal init.lua from lspconfig, everything starts and attaches as expected.