Coc.nvim: CoC causes nvim to freeze declarative Nix setup

Created on 23 Mar 2019  路  14Comments  路  Source: neoclide/coc.nvim

Result from CocInfo

## versions

vim version: NVIM v0.3.4
node version: v8.15.1
coc.nvim version: 0.0.61
term: alacritty
platform: linux

## Error messages

Describe the bug
CoC seems to cause my Neovim to freeze.
This is most likely due to me using NixOS and installing CoC.nvim in a non-standard way. I would love to get it working with Nix though.

To Reproduce
Try to complete a suggestion - choose a completion target with <tab> and <cr>.
https://gist.github.com/29b8423e0d800a17316a6f03bb39b41d

My Setup
The way I install CoC is by cloning this repo, tag v0.0.61, and then I also install the package coc.nvim from npm, to get the node_modules executables.
I then copy node_modules and lib from the npm package into the cloned repo, which is then the package that is sourced in my nvim.
https://gist.github.com/Jomik/bba3cfbfbf1273c07a2180cf4940983c

Can't reproduce

Most helpful comment

All 14 comments

What executables? It only requires node to start coc.nvim process.
You should build it by run yarn install --frozen-lockfile in the cloned folder of coc.nvim.

@chemzqm I am unable to use yarn/npm install in a nix expression, as it is impure.
I am essentially doing that though, as I am just copying the node_modules folder over from an installed package.
Do you have any idea of how I can debug _why_ it freezes? There is no visible output, and I have never tried developing any vim plugins.

Try disable the code at https://github.com/neoclide/coc.nvim/blob/master/autoload/coc/util.vim#L191.

You can download release at https://github.com/neoclide/coc.nvim/releases/latest, extract the binary to build folder inside coc.nvim.

The code you linked does not cause an error, I am able to actually see the list of corrections. The issue seem to be applying the correction.
Sadly the binary does not work on NixOS, pkg gives an error in their bootstrap code.

Note: Nix-os Users must follow these steps:

Install nodejs and yarn via nix-env or put them on /etc/nixos/configuration.nix
sudo nixos-rebuild switch
Plug 'neoclide/coc.nvim', {'tag': '*', 'do': 'yarn install'}
Don't forget to put: set shell=/bin/sh in your init.vim.

this might help.

@chemzqm Thank you :+1:

Yeah - that would work for NixOS. But sadly it is not declarative.
I will however try that to test if it works when running yarn install.

I'll leave this open for now - and update later.

@Jomik I don't use nix, so I have not tried this, but have you seen https://github.com/moretea/yarn2nix.

@chemzqm I have now tried to clone the repo, run yarn install in it, and add it to the runtime path with set runtimepath^=/home/jomik/projects/coc.nvim

It freezes when I press enter: inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
I did have an issue before, which disappeared, where when I pressed enter it would repeatably write pumvisible(), maybe that issue still persists, just invisibly?
Do you have any idea why/how I can fix that?

@Jomik I don't use nix, so I have not tried this, but have you seen https://github.com/moretea/yarn2nix.

I intend to use that - but that does not entirely solve the issue on its own sadly, because it only exposes the binary. :+1:

Funnily enough, when I add coc to runtimepath with += instead of ^= it does not freeze.
But, it still does not work - it does not find auto completions, it can't find type definitions or go to definition.
It does say that the service is started, and it does say coc-tsserver is installed and activated *.

So, stupidly enough, it seems that the freeze was caused by https://github.com/ozelentok/vim-closer together with coc.nvim :+1:
So, that's gone now and I got coc.nvim working just fine! :+1:

if you have map for <CR> https://github.com/ozelentok/vim-closer would cause infinite map sometimes.

That makes sense - I had the proposed map from coc.nvim inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
Thank you, and thank you for the awesome plugin :+1:

Was this page helpful?
0 / 5 - 0 ratings