coc-vimlsp icon indicating copy to clipboard operation
coc-vimlsp copied to clipboard

neovim use this plugin will make a high cpu percentage

Open hanleylee opened this issue 3 years ago • 13 comments

Describe the bug When I use this plugin on vim, it works very well, but when I use it on neovim(terminal), the cpu usage is too high and it will not return back to normal level percentage unless I quit neovim.

To Reproduce Steps to reproduce the behavior:

  1. CocInstall coc-vimlsp
  2. enter any *.vim file

Expected behavior

normal cpu percentage, or let me know how to debug and fix it.

Screenshots image

Desktop (please complete the following information):

  • OS: MacOS

following is my configuration in ~/.nvim/coc-setting.json

    // coc-vimlsp
    "vimlsp.trace.server": "off",
    "vimlsp.debug": false,
    "vimlsp.diagnostic.enable": true,
    "vimlsp.suggest.fromVimruntime": true,
    "vimlsp.suggest.fromRuntimepath": true,
    "vimlsp.indexes.gap": 100,
    "vimlsp.indexes.count": 1,
    "vimlsp.indexes.runtimepath": true,
    "vimlsp.indexes.projectRootPatterns": [
        ".git",
        "autoload",
        "plugin"
    ],
    "vimlsp.filetypes": [
        "vim"
    ],

hanleylee avatar Sep 06 '21 08:09 hanleylee

It will not effect neovim by this extension. The service run in separate program process. Please test with minimum vimrc

iamcco avatar Sep 06 '21 09:09 iamcco

image

I make a screenshot for Activity Monitor of MacOS, it indicate the high cpu percentage is caused by node.

After 10 minutes, the cpu percentage will disappear, it return back to normal. Why does this operation take so long time?

If I uninstall coc-vimlsp, there will no high cpu usage, so I think maybe coc-vimlsp have some dead loop? I don't know how to debug it, I add "vimlsp.debug": true, in my coc-setting.json, but there is no any output for this issue.

hanleylee avatar Sep 06 '21 13:09 hanleylee

set vimlsp.indexes.count to 1 or vimlsp.indexes.gap to 500 or greater and test to see if it happend.

iamcco avatar Sep 07 '21 03:09 iamcco

image

still high. I'm curious why this doesn't happen when I'm using vim, this issue only for neovim.

hanleylee avatar Sep 07 '21 03:09 hanleylee

set vimlsp.indexes.runtimepath to false and test?

iamcco avatar Sep 07 '21 03:09 iamcco

No help, still high cpu percentage. I even try to comment all config about coc-vimlsp, but it still same after I enter any *.vim file

hanleylee avatar Sep 07 '21 07:09 hanleylee

What's your nodejs and neovim version? M1 MacOS ? I don't have any idea about the problem. Also check out the LSP output channel to see if any error message?

And can you check which nodejs process hanging ? image

iamcco avatar Sep 07 '21 08:09 iamcco

nvim version: 0.5.0(installed by homebrew) os: MacOS 11.5.2 node: 16.8.0 cpu: M1

$ ps -ae | grep coc-vim
59176 ??         0:00.17 /opt/homebrew/Cellar/node/16.8.0/bin/node /Users/hanley/.config/coc/extensions/node_modules/coc-vimlsp/out/server --node-ipc --clientProcessId=59121
59177 ??         0:12.57 /opt/homebrew/Cellar/node/16.8.0/bin/node /Users/hanley/.config/coc/extensions/node_modules/coc-vimlsp/out/scan.js --node-ipc
59180 ttys000    0:00.00 grep coc-vim

$ nvim --version
NVIM v0.5.0
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210702-97973-1wtbty6/neovim-0.5.0/build/config -I/tmp/neovim-20210702-97973-1wtbty6/neovim-0.5.0/src -I/opt/homebrew/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/gettext/include -I/tmp/neovim-20210702-97973-1wtbty6/neovim-0.5.0/build/src/nvim/auto -I/tmp/neovim-20210702-97973-1wtbty6/neovim-0.5.0/build/include
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.5.0/share/nvim"

Run :checkhealth for more info


$ node --version
v16.8.0

hanleylee avatar Sep 07 '21 08:09 hanleylee

Please update to latest version and test again. Seems something wrong with M1 MacOS and nodejs. https://github.com/iamcco/vim-language-server/pull/63

iamcco avatar Sep 07 '21 09:09 iamcco

After I update coc plugin by command :CocUpdate, and restart my mac, the cpu percentage is still high if I enter any *.vim file 😂.

What I curious about is why only neovim's coc-vimlsp have problem(coc-vimlsp on vim works very well), actually my vim and neovim share the same configuration

image

hanleylee avatar Sep 07 '21 16:09 hanleylee

I have no idea. Maybe check out the LSP output channel to see if any info?

iamcco avatar Sep 08 '21 01:09 iamcco

Please tell me the step to check the info of the LSP output channel

hanleylee avatar Sep 08 '21 02:09 hanleylee

set "vimlsp.trace.server": "verbose", reproduce the problem and CocCommand workspace.showOutput then select vimlsp

iamcco avatar Sep 08 '21 07:09 iamcco