neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.33k stars 956 forks source link

Language client is not ready yet #3454

Closed vrkansagara closed 2 years ago

vrkansagara commented 2 years ago

index.js:68460 UnhandledRejection: Language client is not ready yet Error: Language client is not ready yet at LanguageClient.onNotification (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:50771:17) at /home/vallabh/.config/coc/extensions/node_modules/coc-phpls/lib/index.js:117:24

client coc abnormal exit with: -1 client coc stopped!

vallabh@vrkansagara  ~  node --version v16.13.0 vallabh@vrkansagara  ~  npm --version 8.1.3 vallabh@vrkansagara  ~  vim --version VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 02 2021 02:58:09)

vrkansagara commented 2 years ago

Ping @fannheyward @chemzqm Facing issue since last week but reported after googling . Please help in this. Thanks in advance

fannheyward commented 2 years ago

Looks like it's coc-phpls registered notification but coc.nvim wasn't ready. Disable coc-phpls and try again.

vrkansagara commented 2 years ago

After disabling coc-phpls

(1) VIM message


[coc.nvim]: Error on "runCommand": Command: intelephense.index.workspace not found

(2) coc-nvim debug log

2021-11-07T20:11:06.984 ERROR (pid:6434) [attach] - Notification error: runCommand [ 'intelephense.index.workspace' ] Error: Command: intelephense.index.workspace not found
    at CommandManager.executeCommand (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:62625:17)
    at Commands.runCommand (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:64111:44)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Plugin.cocAction (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:68276:19)
    at async NeovimClient2.<anonymous> (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:68386:15)
2021-11-07T20:11:07.303 INFO (pid:6434) [attach] - receive notification: highlight

(3) intelephense installed coc-settings.json has only one key-value

 {  "intelephense.licenceKey": "----SECRET--KEY---"}

(4) coc-nvim vim configuration

let g:coc_global_extensions = []
" use command `yarn global dir` in your terminal to checkout yarn global directory.
let g:coc_node_args = ['-r', expand('~/.config/yarn/global/node_modules/source-map-support/register')]
let g:node_client_debug = 1
" let $NODE_CLIENT_LOG_FILE = '/tmp/coc-nvim.log'
let g:coc_node_args = ['--nolazy', '--inspect=6045']

(5) System information

 vallabh@vrkansagara  ~  lsb_release -a
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

Re-enabling coc-phpls and gathering messages if any

(6) Reference log from VIM message

[coc.nvim]: UnhandledRejection: Language client is not ready yet
[coc.nvim]: Error: Language client is not ready yet
[coc.nvim]:     at LanguageClient.onNotification (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:50771:17)
[coc.nvim]:     at /home/vallabh/.config/coc/extensions/node_modules/coc-phpls/lib/index.js:117:24
[coc.nvim]:     at runNextTicks (node:internal/process/task_queues:61:5)
[coc.nvim]:     at processImmediate (node:internal/timers:437:9)
[coc.nvim]: UnhandledRejection: Language client is not ready yet
[coc.nvim]: Error: Language client is not ready yet
[coc.nvim]:     at LanguageClient.onNotification (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:50771:17)
[coc.nvim]:     at /home/vallabh/.config/coc/extensions/node_modules/coc-phpls/lib/index.js:117:24
[coc.nvim]:     at runNextTicks (node:internal/process/task_queues:61:5)
[coc.nvim]:     at processImmediate (node:internal/timers:437:9)
client coc abnormal exit with: -1
client coc stopped!
starting coc.nvim service
[coc.nvim]: Debugger listening on ws://127.0.0.1:6045/bdacb4b5-0ce0-49bd-8801-6df677d754f8
2021-11-07T20:42:24.724 WARN (pid:11458) [events] - Handler of InputChar blocked more than 2s: Error
    at Events.on (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:18379:23)
    at ListManager.init (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:57334:24)
    at Plugin.init (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:68234:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async NeovimClient2.<anonymous> (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:68348:15)
2021-11-07T20:42:39.482 ERROR (pid:11458) [language-client-client] - Error on stop languageserver: ResponseError2: Request shutdown failed with message: Cannot read properties of undefined (reading 'dispose')
    at handleResponse (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:13842:40)
    at processMessageQueue (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:13680:13)
    at Immediate.<anonymous> (/home/vallabh/.vim/vendor/coc.nvim/build/index.js:13666:11)
    at processImmediate (node:internal/timers:464:21) {
  code: -32603,
  data: undefined
}
## versions

vim version: VIM - Vi IMproved 8.2 8022434
node version: v16.13.0
coc.nvim version: 0.0.80-9f6e29b6f9
coc.nvim directory: /home/vallabh/.vim/vendor/coc.nvim
term: dumb
platform: linux

Ping @fannheyward

fannheyward commented 2 years ago

The command intelephense.index.workspace is came from coc-phpls, after you disabled it, the command is not found. That's why you got the error message.

Is there any error message after you disabled coc-phpls and without any commands?

fannheyward commented 2 years ago

And upgrade your coc.nvim to latest release.

vrkansagara commented 2 years ago

@fannheyward I have edited my last comment with many logs for further inspection. to avoid many comments at a time.

Also If you can check with last message which having latest release of coc.nvim coc.nvim version: 0.0.80-9f6e29b6f9 if you need more info, I can. Thanks.

fannheyward commented 2 years ago

The latest release commit is 03c9add

vrkansagara commented 2 years ago

yes tried with @fannheyward still not working. I dont know why it's not working. this is too much effort to work with this package.

vrkansagara commented 2 years ago

I literally feel that this is totally lack of error reporting that it's failing and not working. As an experience person , I cant able to work with this package smoothly then it's a lot difficult for newcomer

fannheyward commented 2 years ago

:CocUninstall coc-phpls first, is there any error now?

vrkansagara commented 2 years ago
[coc.nvim] Removed: coc-phpls
## versions

vim version: VIM - Vi IMproved 8.2 8023570
node version: v16.13.0
coc.nvim version: 0.0.80-03c9add7cd
coc.nvim directory: /home/vallabh/.vim/vendor/coc.nvim
term: dumb
platform: linux
fannheyward commented 2 years ago

As my first comment said, coc-phpls registered some notification event and be fired before coc.nvim is ready.

vrkansagara commented 2 years ago

I am still confuse that to work with php which server to use

(1) https://github.com/marlonfan/coc-phpls (2)


"languageserver": {
  "intelephense": {
    "command": "intelephense",
    "args": ["--stdio"],
    "filetypes": ["php"],
    "initializationOptions": {
      "storagePath": "/tmp/intelephense"
    }
  }
}

or what excetly config it need to work with it

vrkansagara commented 2 years ago

As my first comment said, coc-phpls registered some notification event and be fired before coc.nvim is ready.

If the priority of notification is the issue then , I would say this feature would be inside the core library to mange the priory of registration. so general user does not think about it what to do after and before.

vrkansagara commented 2 years ago

@fannheyward any update on this.

fannheyward commented 2 years ago

I didn't write PHP with coc.nvim, ping @marlonfan for help.

oblitum commented 2 years ago

Sorry to interject a bit.

Hi @vrkansagara. With all respect:

In case you're unaware, the development model this software practices essentially happens in contributor's (people's) free time. For the users, it's normal that they provide grounded critics/complains/bugs, for authors it's normal to at least expect a readily acknowledgement of such problems (but not even that is a requirement). In this system, it's not normal for users to eagerly demand fixes and responses from authors. Notice that's a different thing from reporting grounded critics/complains/bugs. "To report" doesn't equate "to demand".

Demanding is proper of proprietary software, crowdfunding software, and such, where yourself have funded the software and their authors. So it's generally natural in that case that backers get answers for their demands they're paying for (notice that this excludes donationware, donation ≠ paying).

Lots of software in the open source world follows this, so I've written the above not only in respect to coc.nvim, but so that you be more aware that to eagerly demand fixes and responses doesn't fit this model, and hence isn't well viewed in general.

Regards.

fannheyward commented 2 years ago

Also ping @yaegassy for coc-intelephense.

yaegassy commented 2 years ago

@vrkansagara Hi, I prepared the same debian (bullseye) environment as yours with docker and tried it.

Both my coc extension @yaegassy/coc-intelephense and coc-phpls start without any problem.

I think the problem is specific to your environment. You can try it in a virtual machine, docker, etc. and compare it to your environment where the problem is.


Docker:

docker run -it --rm debian:bullseye bash

Prepare:

apt update -y && apt upgrade -y && apt install vim build-essential curl git -y

curl -fsSL https://deb.nodesource.com/setup_16.x | bash -

apt-get install -y nodejs

apt install php -y

# plugin manger: vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

# vimrc
cat <<EOF > ~/.vimrc
syntax on
filetype plugin indent on
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
EOF

vim +'PlugInstall --sync' +qall &> /dev/null

Start Vim:

vim

CocInstall and quet:

Of course, you can also install coc-phpls

:CocInstall @yaegassy/coc-intelephense
:q

Edit:

mkdir -p /tmp/check
cd /tmp/check
vim sample.php

Capture:

coc-php-related-ok
fannheyward commented 2 years ago

Thank you veeeeery much for your step by step tests @yaegassy.

vrkansagara commented 2 years ago

@yaegassy and @fannheyward let me follow things and get back here.

vrkansagara commented 2 years ago

@yaegassy I followed above steps and here is the result.

(1) With docker instruction it's working fine (2) With debian os it's working fine by following (i) remove all rm -rf .vim* (ii) follow the above instruction except docker (3) There is a different between release branch and given commit by @fannheyward 03c9add image (4) this package was working with https://github.com/tpope/vim-pathogen but from given release commit it not working any more. I dont know what is wrong but this is not working with this package manger now. (5) I tried multipal way to work with this package but no luck with tpope/vim-pathogen

Ref:- I am using git submodule functionality to work with tpope here https://github.com/vrkansagara/ide/blob/master/submodule.sh

And replay to @oblitum , Yes, I know how the open source projects are working and if you can look my past comment that I already mentioned that

Ping @fannheyward @chemzqm Facing issue since last week but reported after googling . Please help in this. Thanks in advance

so If you feel it's rude please forgive me.

fannheyward commented 2 years ago

@vrkansagara try another package manager, likes vim-plug or packer.vim.

vrkansagara commented 2 years ago

@yaegassy thank you for your test case, But I would like to make one point here that you are using simple test for the php built in functionalities please give a try of composer autoload library because mostly user is using composer to work with this php and large project .

oblitum commented 2 years ago

(3) Have you noticed the release branch is a branch with compiled version, where many commits from master as stashed? Comparison of commit history on github between master and release branches has no meaning. Notice the commit @fannheyward talked about is the last commit from master that has become part into last commit of release, but it's stashed there with many others (pay attention this is a commit from master branch, even thought the commit comment on release refers to it, it's not a commit on release branch, it's just in the comment). Notice that picking from release, you don't need to compile with yarn/npm, but if you pick from master you need to compile.

vrkansagara commented 2 years ago

@vrkansagara try another package manager, likes vim-plug or packer.vim.

sure @fannheyward I can give it a try, but if you are open with vim-pathogen I am really happy to stay with it because (1) this is already used by lot number of user (2) it is well tested till date (3) many custom build vim configuration are using tpope solutions (4) my custom build ide deployed many times at production server

So here is few things which hard to change the habit of user

oblitum commented 2 years ago

vim-pathogen is really not endorsed anymore, it's too old.

vrkansagara commented 2 years ago

vim-pathogen is stable and people still using out there

oblitum commented 2 years ago

Read this by tpope himself: https://github.com/tpope/vim-pathogen/commit/e9fb0914dba5bdfe2feaa364dda2e9495c5620a2.

fannheyward commented 2 years ago

@vrkansagara vim-pathogen is too old to use, check the commits history, it was about 2y without any new features or bugs fixing.

If you don't want to change to vim-plug or other plug-in manager, check the vim built-in package manager, as the notes on vim-plugogen:

For new users, I recommend using Vim's built-in package management instead. :help packages

The main issue isn't what plugin manager to use, but use the compiled coc.nvim.

vrkansagara commented 2 years ago

@oblitum you made a point here, and I do also know about that warning. But still the point remain same that if thing was working as expected earlier then why not working now.

@vrkansagara vim-pathogen is too old to use, check the commits history, it was about 2y without any new features or bugs fixing.

If you don't want to change to vim-plug or other plug-in manager, check the vim built-in package manager.

For new users, I recommend using Vim's built-in package management instead. :help packages

The main issue isn't what plugin manager to use, but use the compiled coc.nvim.

So @fannheyward does it mean that installation instruction is missing ?

fannheyward commented 2 years ago

The installation is not missing, you can use anything you like to install coc.nvim, but some packages manager maybe not working great.

You can also install manually, clone coc.nvim repo, checkout the release branch and set runtimepath to it.

fannheyward commented 2 years ago

We run to the wrong direction about which packages manager to use, let's back to your issue.

As the tests by yaegassy, coc.nvim works well for PHP language server. Please check your environment and try with minimal vimrc.

yaegassy commented 2 years ago

@yaegassy thank you for your test case, But I would like to make one point here that you are using simple test for the php built in functionalities please give a try of composer autoload library because mostly user is using composer to work with this php and large project .

@vrkansagara I'm using @yaegassy/coc-intelephense in my Laravel project. It works fine.

As has already been pointed out, it may be a problem with the package manager you are using!

yaegassy commented 2 years ago

@vrkansagara The maintainer of coc.nvim, fannheyward and chemzqm, probably also use vim-plug.

oblitum may be using something else, but since oblitum is a professional user of coc.nvim, he may be able to adjust some things. :)

You may have less trouble if you use vim-plug, which is used by the main committer of coc.nvim.

yaegassy commented 2 years ago

@vrkansagara Did you change the plugin manager to fix the problem? If it is resolved, please close this issue.

vrkansagara commented 2 years ago

@yaegassy I am on the way to detail answer so other user will not face such issues.

oblitum commented 2 years ago

TBH, this is not a complicated matter at all, and it's a known fact. Most people actually don't use pathogen anymore, and if they do, by coc.nvim's README, they realize they need to fetch latest release branch if they don't want to compile, if they fetch master, they generally know they have to, it's in the top of README.

oblitum may be using something else, but since oblitum is a professional user of coc.nvim, he may be able to adjust some things. :)

heh. Actually I once suggested @chemzqm to change the default branch on GitHub to release to precisely avoid this, and he did. For me that was fine and I didn't have to set an specific branch on package manager anymore, release would come by default. chemzqm though expressed this wasn't happening always (in vim-plug if I recall correctly), personally I have never seen it disrespecting GitHub's default branch. In the end chemzqm put back master as default and set instructions with specific branches always.

vrkansagara commented 2 years ago

I am very thankful to all the commentators @oblitum @yaegassy @fannheyward , The issue was related to the vim package manager and few confusion about the with branch to use.

The ultimately result is:- the issue is resolved by following two things.