marlonfan / coc-phpls

🐭 php language server for coc.nvim
MIT License
212 stars 16 forks source link

CocAction timeout after 30 seconds when jumping to definition / finding references, which are in the same buffer #58

Open Nemoden opened 4 years ago

Nemoden commented 4 years ago

Jump to definition only works after a 30 seconds timeout when jumping to a definition which is defined in the same buffer.

To Reproduce

  1. Create a php file, define class Foo
  2. Defined 2 methods: Foo::caller() and Foo::callee()
  3. Call callee from Foo::caller... i.e. $this->callee()
  4. Place a cursor on callee inside Foo::caller method, use coc's goto definition to jump to callee
  5. Experience tranquility for 30 seconds, which results into correct definition jump, btw.
  6. Note, this kind of behaviour only takes effect if a symbol that is being jumped to is in the same buffer.

Expected behavior Goto definition shouldn't end up in a 30 seconds timeout.

Videos asciicast

asciicast

Desktop

coc-settings.json

{
  "list.normalMappings": {
    "<C-c>": "do:exit"
  },
  "list.insertMappings": {
    "<C-c>": "do:exit"
  },
  "intelephense.telemetry.enabled": false
}

~/.config/coc/extensions/package.json contents:

{
  "dependencies": {
    "coc-phpls": ">=2.1.8"
  }
}

Additional information

Using CocActionAsync solves the problem.

When goto definition is triggered for a none-async action, whole vim "freezes" for the duration of 30 seconds before the timeout happens.

:CocOpenLog right after the problem occurs gives:

2020-04-14T14:51:19.757 INFO (pid:16453) [language-client-index] - phpls started with 16468
2020-04-14T14:51:19.769 INFO (pid:16453) [plugin] - coc 0.0.78-fc983ce6dd initialized with node: v12.16.1

Temporary solution:

"nmap <silent> <leader>gd <Plug>(coc-definition)
nmap <silent> <leader>gd :call CocActionAsync('jumpDefinition')<CR>
" nmap <silent> <leader>gr <Plug>(coc-references)
nmap <silent> <leader>gr :call CocActionAsync('jumpReferences')<CR>