question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clangd not found in coc-clangd but found in $PATH

See original GitHub issue

Coc-clangd doesn’t detect my clangd binary installed with homebrew at /usr/local/Cellar/llvm/10.0.0_3/bin/clangd that I symlinked to ~/.local/bin/clangd and I added ~/.local/bin/ to my $PATH. I can run clangd from inside neovim as :!clangd without a problem but coc-clangd can’t detect it without hardcoding the path in coc-settings.json with "clangd.path": "/usr/local/opt/llvm/10.0.0_3/bin/clangd". If I symlink the binary to /usr/local/bin instead it just works.

I would like to avoid hardcoding the path to coc-settings.json since it wouldn’t be portable to my Linux computer. So my question is: where does coc-clangd search for clangd and why is it not using my $PATH?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sam-mccallcommented, Apr 23, 2020

You’ve put “~/.local/bin” on your path instead of “/Users/<MY_USERNAME>/.local/bin”. This is nonstandard - PATH should contain real paths. Bash supports it as an extension (on my system, when invoked as bash but not when invoked as sh) but not all tools do. In particular the npm-which library used by coc to find the binary doesn’t support this.

You can fix this by unquoting the ~ so the shell will expand it:

 [[ ":$PATH:" != *:~/.local/bin/:* ]] && PATH=~/.local/bin/:"${PATH}"
0reactions
renydddcommented, Sep 21, 2020

ln -s /usr/local/bin/clangd /$HOME/.config/coc/extensions/coc-clangd-data/install/10.0.0/clangd_10.0.0/bin/clangd

Read more comments on GitHub >

github_iconTop Results From Across the Web

CocCommand clangd.install · Issue #61 - GitHub
The guide claims coc-clangd will try to find clangd in my $PATH. I know that clangd is not in my $PATH, but I...
Read more >
Clangd is not found in VIM using neoclide / coc.nvim
clangd-10 will be installed as clangd-10 , try this: sudo ... Make sure clangd can been found from $PATH , check: which clangd...
Read more >
[coc.nvim] clangd was not found on your PATH. - Reddit
Since my last CocUpdate my clangd server crashes when I try to expand a node from the. :CocCommand document.showIncomingCalls. with the message :....
Read more >
coc-clangd - npm
in vim, run :CocInstall coc-clangd; coc-clangd will try to find clangd from your $PATH , if not found, you can run :CocCommand ......
Read more >
Getting started with clangd — Extra Clang Tools 10 ...
Choose View –> Extensions, then search for “clangd”. (Make sure the Microsoft C/C++ extension is not installed). After restarting, you should see red...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found