Petross404
Petross404

Reputation: 317

Vim warning: Looks like you've configured clangd in coc-settings.json, you should remove it to use coc-clangd

I 've recently started to code on Vim and while it's not easy, it's worth it. I am struggling to figure out basic things that I had for granted in an IDE like KDevelop or VSCode especially when it comes to browsing the code by finding references, having autocomplete etc.

Lucky for me I have found CoC (-clangd etc). But I am getting an error which I can't quite understand and debug:

[coc.nvim] Looks like you've configured clangd in coc-settings.json, you should
 remove it to use coc-clangd

Of course I have configured clangd inside this file exactly because the coc-clangd plugin wants me to like this.

My coc-settings.json:

  {
          "languageserver":
          {
                  "clangd":
                  {
                          "command": "clangd",
                          "rootPatterns": ["compile_flags.txt",
                                          "compile_commands.json"],
                          "filetypes":["c",
                                          "cc",
                                          "cpp",
                                          "c++",
                                          "objc",
                                          "objcpp"]
                  },
                  "cmake":
                  {
                          "command": "cmake-language-server",
                          "filetypes": ["cmake"],
                          "rootPatterns": ["build/"],
                          "initializationOptions":
                          { 
                                  "buildDirectory": "build"
                          }
                  }
          }
          
  }

Autocompleting (printf for example) works normally. So what is this warning about? Is my configuration wrong or am I missing something from my setup?

Thanks in advance.

EDIT: I used to edit the inner "clangd" string while it should be like this:

 {
          "languageserver":
          {
                  "coc-clangd": <-- This
                  {
                          "command": "clangd",

Thank you very much.

Upvotes: 6

Views: 12400

Answers (3)

Craig Yang
Craig Yang

Reputation: 340

Does it fix your problem after changing the coc-settings.json into something like this?

{
          "languageserver":
          {
                  "coc-clangd": <-- This
                  {
                          "command": "clangd",

I do fix this problem on my setup by changing the language server name to coc-clangd.

And of course, please install coc-clangd by cocInstall and clang package on your OS in advance.

Upvotes: 1

fannheyward
fannheyward

Reputation: 19277

You don't need to setup clangd in coc-settings.json while using coc-clangd. Remove the clangd section in your coc-settings.json.

Upvotes: 3

Base64__
Base64__

Reputation: 107

the error message wants you to install coc-clangd and use that in coc-settings.json instead of plain old clangd. install coc-clangd and replace "command": "clangd", with "command": "coc-clangd", (or whatever the command for coc-clangd is)

edit: it is after all just a warning, and you should be able to ignore it. if the fact that there is a warn there annoys you, there might be an option to disable warns.

Upvotes: 1

Related Questions