Maxattax97 / coc-ccls

CCLS (C/C++) extension for coc.nvim
https://github.com/neoclide/coc.nvim
24 stars 3 forks source link

extension "coc-ccls" doesn't contain main file #2

Open qadzifi opened 4 years ago

qadzifi commented 4 years ago

I accidentally delete my neovim plugged directory and when I try to open neovim again I get this message

extension "coc-ccls" doesn't contain main file

Expected behavior

No error message.

System information

alichtman commented 4 years ago

I have this same error message, but I did not delete the ~/.vim/plugged dir. Any ideas on how to fix this?

Uninstalling and reinstalling did not fix.

Nelyah commented 4 years ago

I had the same issue with the error [coc.nvim]extension "coc-ccls" doesn't contain main file /path/to/home/.config/coc/extensions/node_modules/coc-ccls/lib/extension.js.

So kind of "fixed it" temporarily by doing:

cd ~/.config/coc/extensions/node_modules/coc-ccls
ln -s node_modules/ws/lib lib
surmish commented 4 years ago

@Nelyah Is this a permanent fix? I've been seeing the same issue since past few weeks. The error starting showing up without any changes, except maybe updates to the plugin/vim.

Nelyah commented 4 years ago

@surmish If by permanent you mean it persists through reboot, then yes. However, although it fixes the issue, it doesn't fix its root cause (file not being at its supposed location in the first place). The error is most likely due to a plugin update in which the file moved and its old location was still trying to be accessed.

This fix should hold until the plugin gets updated again with a fix for the underlying issue.

aganm commented 4 years ago

Same issue, error started to show up when I updated coc with :PlugUpdate.

Paul-Houser commented 4 years ago

I'm also having this issue. Can confirm the temporary fix in the comment from @Nelyah makes the error go away.

yamsu commented 4 years ago

I had the same issue with the error [coc.nvim]extension "coc-ccls" doesn't contain main file /path/to/home/.config/coc/extensions/node_modules/coc-ccls/lib/extension.js.

So kind of "fixed it" temporarily by doing:

cd ~/.config/coc/extensions/node_modules/coc-ccls
ln -s node_modules/ws/lib lib

Small Correction It should be

cd ~/.config/coc/extensions/node_modules/coc-ccls
ln -s ../ws/lib lib
Nelyah commented 4 years ago

@yamsu Hm, that would point to the lib folder ~/.config/coc/extensions/node_modules/coc-ccls/../ws/lib which doesn't exist on my end.

Maybe the location varies depending on the version 🤷‍♀️

yamsu commented 4 years ago

Yeah I guess there is a difference in the directory structure. I had to use

ln -s ../ws/lib lib

From the coc-ccls directory, but this solution works thanks.

DiegoGuidaF commented 4 years ago

Having the same issue though I can't seem to fix it in the same way. I don't have any "ws/lib" folder, the one I have is inside .config/nvim/plugged/coc.nvim/lib and it doesn't have an "extension.js" file but an "extensions.js" file (note the "s" at the end).

I have symlinked it to the file coc-ccls expects and it indeed does seem to work, but I don't think this is intended in any way since none of my other coc pluggins require this weird symlink...

ythomop commented 4 years ago

Running: cd ~/.config/coc/node_modules/coc-ccls; npm install; python build.py

creates the required lib directory. However, when opening a file that starts coc-ccls, one gets the following error: image

Edit: Apart from that error, the extensions seems to be working, since errors get detected and showed. Edit2: https://github.com/Maxattax97/coc-ccls/issues/3#issue-600116270

Ueeek commented 4 years ago

I had the same trouble.

In my case, Error says, [coc.nvim]extension "coc-ccls" doesn't contain main file /path/to/home/.config/coc/extensions/node_modules/coc-ccls/lib/extension.js.

But extension.js is actually placed at /path/to/home/.config/coc/extensions/node_modules/coc-ccls/node_modules/ws/lib/extension.js. and, coc-ccls/ does not have lib dir. So, at /coc-ccls

mkdir lib
cd lib
ln -s ../node_modules/ws/lib/extension.js ./extension.js

solve the problem

gibfahn commented 4 years ago

Adding the script I ended up adding to my dotfiles (based on the above code snippets), should be copy-pastable unless you installed coc-ccls to a different directory (in which case it should do nothing):

set -x
existing=~/.config/coc/extensions/node_modules/coc-ccls/node_modules/ws/lib/extension.js
missing=~/.config/coc/extensions/node_modules/coc-ccls/lib/extension.js
if [[ -e "$existing" && ! -e "$missing" ]]; then
  mkdir -p "$(dirname "$missing")"
  ln -s "$existing" "$missing"
fi
set +x