iamcco / coc-vimlsp

viml language server
216 stars 7 forks source link

neovim use this plugin will make a high cpu percentage #39

Open hanleylee opened 3 years ago

hanleylee commented 3 years ago

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):

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"
    ],
iamcco commented 3 years ago

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

hanleylee commented 3 years ago

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.

iamcco commented 3 years ago

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

hanleylee commented 3 years ago

image

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

iamcco commented 3 years ago

set vimlsp.indexes.runtimepath to false and test?

hanleylee commented 3 years ago

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

iamcco commented 3 years ago

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

hanleylee commented 3 years ago

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 brew@HMBRW-A-001-M1-005.local

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
iamcco commented 3 years ago

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

hanleylee commented 3 years ago

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

iamcco commented 3 years ago

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

hanleylee commented 3 years ago

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

iamcco commented 3 years ago

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