0

I have a c project and I would like to use the feature of LSP in Neovim such as gd (go to definition).

I follow each of these materials to configure LSP

However, I've encountered some problems.

  1. Following the guide in clangd.llvm.org/installation, I execute sudo apt-get install clangd-10 to install clangd (sudo apt-get install clangd-12 will result in E: Unable to locate package clangd-12 even though I have executed sudo apt-get update). But when I want to check the version of clangd by executing clangd --version, I got Command 'clangd' not found as it is not installed yet.

  2. After executing bear <my_build_command>, I got the complile_command.json. But when I open .c file in the project, I got the information: Spawning language server with cmd: clangd failed. The language server is either not installed, missing from PATH, or not executable.

--

I think the problem may result from 1. After Googleing the related information and tried to reinstall clangd, clangd --version still result in the same: Command 'clangd' not found.

Do I missing something or what? Any one can give me a help? Thanks.

6
  • I have the impression that your current problem is more related to the installation of clangd on Ubuntu than related to Vim and the relation between clangd and Vim. I recommend you to contact some clangd knowledgeable people first (although some could also follow this site ;-) ). Jun 29 at 16:47
  • 1
    Hi @VivianDeSmedt Thanks for replying. Finally, I fixed it somehow. For someone else might need the information, I follow the answer part of this post, and then clangd --version gives me the version information.
    – HRC
    Jun 30 at 3:28
  • Thanks for the follow up. Did you also solved the integration with Vim? Jun 30 at 3:57
  • 1
    Yes. In my case, installation of clangd is just the last thing to make LSP working on Neovim.
    – HRC
    Jun 30 at 16:18
  • 1
    Thanks for replying and giving the idea. :-)
    – HRC
    Jul 2 at 5:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.