Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problems with clangd 7 #23

Closed
justinmk opened this issue Nov 17, 2019 · 4 comments
Closed

problems with clangd 7 #23

justinmk opened this issue Nov 17, 2019 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@justinmk
Copy link
Member

justinmk commented Nov 17, 2019

(For reference, so others can find this)

clangd --version
clangd version 7.0.0-3~ubuntu0.18.04.1 (tags/RELEASE_700/final)

With the default clangd config from nvim-lsp:

~/.local/share/nvim/vim-lsp.log:

"rpc">  "clangd">       "stderr">       "clangd"
"rpc">  "clangd">       "stderr">       ": Unknown command line argument '"
"rpc">  "clangd">       "stderr">       "--background-index"
"rpc">  "clangd">       "stderr">       "'.  Try: '"
"rpc">  "clangd">       "stderr">       "clangd"
"rpc">  "clangd">       "stderr">       " -help'\n"
"rpc">  "clangd">       "stderr">       "clangd"
"rpc">  "clangd">       "stderr">       ": Did you mean '-"
"rpc">  "clangd">       "stderr">       "ppc-gen-isel"
"rpc">  "clangd">       "stderr">       "'?\n

That can be fixed by overriding cmd:

  local nvim_lsp = require 'nvim_lsp'              
  local util = require 'nvim_lsp/util'          
  nvim_lsp.clangd.setup {                                  
    cmd = {"clangd"},                                 
    root_dir = util.root_pattern('build/compile_commands.json', '.git'),
  }

Also note that Neovim puts build/compile_commands.json in "build" directory, so the root_dir is overridden there.

If I try to complete something in eval.c, this is the log result:

"I[16:01:24.764] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 returned.\n"
"I[16:01:24.764] --> reply(4)\n"         
"I[16:04:43.809] <-- textDocument/completion(5)\n"         
"I"         
"["         
"16:04:43.874"         
"] "         
"Code complete: Ignoring sema code complete callback with Recovery context."         
"\n"         
"I"         
"["         
"16:04:43.876"         
"] "         
"Code complete: "         
"0"         
" results from Sema, "         
"0"         
" from Index, "         
"0"         
" matched, "         
"0"         
" returned"         
"."         
"\n"         
"I"         
"["         
"16:04:43.879"         
"] "         
"--> reply("         
"5"                                                                                                                             
")"
"\n"
@justinmk justinmk added the documentation Improvements or additions to documentation label Nov 17, 2019
@justinmk
Copy link
Member Author

justinmk commented Nov 17, 2019

With clangd version 8, some things work:

  • --background-index
  • inline diagnostics/warnings
  • LSP log shows that "indexing" happened

But still can't get omnicompletion to work.

Edit: After installing latest Nvim and nvim-lsp, and restarting Nvim, omnicompletion works now. Yay!

TODO:

  • We need an easy way for users to check the "status" of LSP.

@norcalli
Copy link

We could add an automatic check for clangd version on startup. This is something that I've been considering separately, which is that when a user uses our setup function, it doesn't check if you have the binary available. That means it will error when you try to use it.

We could, in on_new_setup(), check the clangd version and provide a more valuable error or change the arguments we pass.

@norcalli
Copy link

I was told by bfredl, though, that clangd 9 was the only one to have fixed most LSP things, though. I agree, we should put it in the docs that clangd 9 is required/recommended.

@justinmk justinmk changed the title clangd 7 problems problems with clangd 7 Nov 18, 2019
@justinmk
Copy link
Member Author

justinmk commented Nov 18, 2019

After installing latest Nvim and nvim-lsp, and restarting Nvim, omnicompletion works now (with clangd version 8). Yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants