Search code examples
neovimlanguage-server-protocolcoc.nvimnvim-lspconfig

How to triger clnagd.switchSourceHeader using built-in nvim lsp


I used to do it with Coc.nvim

:CocCommand clangd.switchSourceHeader

But now I have moved to built-in nvim lsp and haven't any idea how to the same.

I found this solution for coc, but still dont how to do this for nvim lsp.

execute 'edit' CocRequest('clangd', 'textDocument/switchSourceHeader', {'uri': 'file://'.expand("%:p")})

Solution

  • When using the built-in LSP client, I recommend using the nvim-lspconfig plugin for configuring the servers. For clangd, it creates a command :ClangdSwitchSourceHeader (see documentation).