In https://github.com/NixOS/nixpkgs/pull/64426 some coc vim extension plugins were added, however many are missing overrides, which would make them work out of the box.
As a datapoint, I tried installing coc.nvim
extensions using nixpkgs. I started with coc-eslint
, and wasn't able to get it working. Coc showed the plugin as installed via RPT, but it just didn't do anything.
If you're using the native vim packages mechanism, this may be the reason.
Thanks for the response @timokau. I am using the native Vim packages mechanism.
I quickly skimmed that issue and the comments, though I'm not sure what this means for me. Is there a workaround, or am I out of luck until the issue is resolved?
(If it's not a simple answer, and the linked issue and comments contain the information I'm looking for, feel free to just say: "dude, it's all in that issue, just actually read it carefully" 馃槢)
Here's my current Nix Neovim config in case it's helpful:
https://github.com/malob/nixpkgs/blob/43edd8cb7b30ae91b45547b65b81f05852828142/overlays/neovim.nix#L37-L69
Try configure.plug.plugins
instead of configure.packages.myVimPackages.start
E.g. https://github.com/rvolosatovs/infrastructure/blob/3bfd3fa5ba0a2e281dc847d52a2563d3e7620eab/nixpkgs/neovim/default.nix#L7-L40
@rvolosatovs, just made that change along with adding withNodeJs = true;
and I'm still experiencing the same issue with coc-eslint
馃槥.
Thanks for the response @timokau. I am using the native Vim packages mechanism.
I quickly skimmed that issue and the comments, though I'm not sure what this means for me. Is there a workaround, or am I out of luck until the issue is resolved?
(If it's not a simple answer, and the linked issue and comments contain the information I'm looking for, feel free to just say: "dude, it's all in that issue, just actually read it carefully" stuck_out_tongue)
Sorry, should've been more clear. Unfortunately there currently is no easy workaround for native plugins. It means that sometimes the plugin will just load in the wrong order and override each other. The "workaround" is to use a different mechanism (like vim-plug, pathogen) for those plugins or manage runtimepath manually.
But if that didn't fix your problem, its probably due to something else.
@timokau, thanks for the clarification. I'll do some more investigating and see if I can figure out why vimPlugins.coc-eslint
is misbehaving with my config.
has anyone figured out how to make coc-python work ? I wanted to give the microsoft python LSP a spin but I am not comfortable with the dotnet ecosystem.
I can't get coc-tabnine to work for the life of me. It doesn't seem to ever d/l the binary.
Seems like @garbas solved it in https://github.com/garbas/nvim-config/tree/master/coc-extensions
Not sure how to upstream that though...
@teto not everything works. i think last thing i was trying to get coc-python to work but lost the battle with time :) but coc-rls worked like magic for rust :smile:
Also I have no idea how to upstream this, since some coc extensions also require some settings to be set correctly (https://github.com/garbas/nvim-config/blob/31a2e3b0482b0ab4048d96006e8a3576e949ca54/default.nix#L49)
Solved! I having a duplicated message problem. Have no idea what to do next
https://discourse.nixos.org/t/coc-nvim-nvim-stuff/2974/14?u=wizzup
https://github.com/neoclide/coc.nvim/issues/1270
I've been looking into this myself, and so far, it looks like what @teto said in https://github.com/NixOS/nixpkgs/pull/64426 about needing custom overrides for different extensions is true.
From what I've been able to find out by reading sources, it looks like coc looks for extensions from its package.json file, the coc-extensions
subdirectory under the user's vim home path, and the vim runtimepath (or "rtp"). The extensions are getting loaded into the rtp, but one problem is that not all of them are usable in their current state. For example, coc-prettier's entry point is lib/index.js
, which needs to be compiled by Webpack, but the package provided by Nix is the unprocessed source code.
I believe that I've figured out a general path forward.
(All? Most?) Coc extensions are NPM packages. At least, the ones that I need for my use case are NPM packages, and they're broken because they're not being properly built by the code in generated.nix
. They're instead exposing the raw source code, which sometimes is in TypeScript, doesn't have necessary artifacts, etc.
My proposed approach is two steps:
nodePackages
, thenvimPlugins
using overrides.nix
I've opened a PR for the nodePackages.coc-prettier
extension here: https://github.com/NixOS/nixpkgs/pull/72501. ~Once it's merged, I'll open a PR for the vim plugins side.~ I've opened a PR for vimPlugins.coc-prettier
here: https://github.com/NixOS/nixpkgs/pull/72506
FTR, it seems that all my coc extensions work fine now (and probably could have from the start as well) due to this commit https://github.com/rvolosatovs/infrastructure/commit/e4b59fb19edb8ae10b8b206d57463b86d9c122ee - the key is ordering, coc-nvim
must come first, which is quite obvious.
I'm pretty embarassed by how long it took me to figure it out, but then again I did not rely on these anyway.
Just wanted to point it out for future reference in case someone is struggling with this.
Can anyone here shed some light on this? https://discourse.nixos.org/t/how-to-override-coc-vim-plugin/7991
I'm basically trying to override a coc
plugin for vim
but I can't figure out how all this works.
If anyone is still interested in in, please test #96993 and report if it works for you. If nobody complains, I'll assume #96993 fixes this issue.
Most helpful comment
I believe that I've figured out a general path forward.
(All? Most?) Coc extensions are NPM packages. At least, the ones that I need for my use case are NPM packages, and they're broken because they're not being properly built by the code in
generated.nix
. They're instead exposing the raw source code, which sometimes is in TypeScript, doesn't have necessary artifacts, etc.My proposed approach is two steps:
nodePackages
, thenvimPlugins
usingoverrides.nix
I've opened a PR for the
nodePackages.coc-prettier
extension here: https://github.com/NixOS/nixpkgs/pull/72501. ~Once it's merged, I'll open a PR for the vim plugins side.~ I've opened a PR forvimPlugins.coc-prettier
here: https://github.com/NixOS/nixpkgs/pull/72506