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

:CocCommand clangd.install #61

Closed
trebinor opened this issue Jun 14, 2020 · 9 comments
Closed

:CocCommand clangd.install #61

trebinor opened this issue Jun 14, 2020 · 9 comments
Labels
bug Something isn't working

Comments

@trebinor
Copy link

I'm following the "Quick Start" guide and have run into problems on the :CocCommand clangd.install step. The guide claims coc-clangd will try to find clangd in my $PATH. I know that clangd is not in my $PATH, but I see no output from :CocInstall coc-clangd that it looked and failed to find it. I only see a single line with a green check that it installed into .config/coc/extensions/node_modules/coc-clangd.

When I run :CocCommand clangd.install to have it fetch the latest release, it returns [coc.nvim] Command: clangd.install not found.

@trebinor trebinor added the bug Something isn't working label Jun 14, 2020
@fannheyward
Copy link
Member

You need to open C/C++ files to run :CocCommand clangd.install.

@Roulbac
Copy link

Roulbac commented Jun 18, 2020

I had the same issue, but then it displays the following message and does nothing else

[coc.nvim] clangd was not found on your PATH. :CocCommand clangd.install will install 10.0.0.

@trebinor
Copy link
Author

Did you check if it downloaded clangd? It downloaded for me, and I think you're supposed to add the clangd path to your PATH and restart vim. I gave up before I could get it working, because CentOS 7 won't run clangd 10 due to its glibc being too old. I'd happily try an older release without that requirement, but 10.0 seems to be only release posted, not counting pre-releases.

@rodhash
Copy link

rodhash commented Oct 3, 2020

Had same issue and updating my env variable PATH including the clangd fixed for me.

export PATH=$PATH:/home/rodhash/.config/coc/extensions/coc-clangd-data/install/10.0.0/clangd_10.0.0/bin

@xrisk
Copy link

xrisk commented Dec 27, 2020

Also had to manually add the installation directory to my PATH. Not sure if this is intended behavior? If so, perhaps we should add it to the readme?

@juanMarinero
Copy link

juanMarinero commented Feb 11, 2021

MWE for newbies (like me):

  1. create Node project
dir01="$HOME/cocnvim_c"
mkdir $dir01 && cd $dir01
npm init # all default
npm i coc-clangd
  1. Add $PATH
cd $HOME/.config/coc/extensions/coc-clangd-data/install/*/clang*/bin && echo $PWD && cd - # copy echo
vim ~/.bashrc  # add line: export PATH=$PATH:[paste echo]
  1. test it:
python3.8 -c "print('$PATH'.replace(':','\n'))" | grep -E 'coc|$'  # check it
vim $dir01/main.c

@juanMarinero
Copy link

Amend alternative to create a Node project (step 1 of my previous comment):
sudo npm i --global coc-clangd

@CengsBlanky
Copy link

I came up with the same problem, but I figured out why, just run :CocConfig, and it opens the config file: coc-settings.json, add clangd.path as folllows:

{
    "clangd.path": "/usr/local/opt/llvm/bin/clangd"
}

or if you installed clangd as coc suggests(:CocCommand clangd.install), the path should be something like this:
$HOME/.config/coc/extensions/coc-clangd-data/install/*/clang*/bin/clangd
make sure clangd is included in the path
as you can see, I use llvm, which already includes clangd, so I do not need to install clangd suggested by coc

@juanMarinero
Copy link

Btw: if C/C++ file is NOT Vim-opened through terminal, the ~/.profile should have proper $PATH too: shell configuration files (like ~/.bashrc or /etc/profile) affect only the applications started from shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants