'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 1:[1]

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).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 luator