neoclide / coc.nvim

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

Fail to display `signatureHelp` in a deterministic way #743

Closed gvolpe closed 5 years ago

gvolpe commented 5 years ago

Result from CocInfo

## versions

vim version: NVIM v0.3.1
node version: v10.15.3
coc.nvim version: 0.0.65
term: xterm-256color
platform: linux

## Error messages

## Output channel: snippets

## Output channel: languageserver.scalametals
... lots of tracing logs here ...

Describe the bug

Results from signatureHelp are not being displayed by coc.nvim on very specific cases. The response from the LSP Server seems correct and it works in VS Code for example. See here.

To Reproduce

I debugged the LSP server as suggested here and pasted the results of :CocCommand workspace.showOutput into the inspector.

Here are the logs: https://files.gitter.im/neoclide/coc.nvim/URKQ/coc-metals-trace-2.log

I don't think a minimal vim config is needed since it seems to happen always regardless of the configuration but just in case my config can be found here.

Below are the signatures shown in the logs that are displayed as expected:

And here are the signatures that are not being displayed despite given a correct server response:

The cases in which the client doesn't display the signature help are always the same. I could try List(1).reduce 100 times and I will never get it to work. Same for the cases that do work: the signature is always displayed.

Coc debug logs

Here's more information of what's being logged by coc in debug mode:

2019-05-01T10:44:48.098 DEBUG (pid:5636) [events] - Event: CompleteDone [ { word: 'fold',
    menu: '[B](ifEmpty: => B)(f: Int => B): B [LS]',
    user_data:
     '{"cid":1556700285,"source":"languageserver.scalametals","index":8}',
    info: '',
    kind: 'f',
    abbr: 'fold[B](ifEmpty: => B)(f: Int => B): B~' } ]

2019-05-01T10:45:56.956 DEBUG (pid:5636) [events] - Event: CompleteDone [ { word: 'drop',
    menu: '(n: Int): List[Int] [LS]',
    user_data:
     '{"cid":1556700355,"source":"languageserver.scalametals","index":6}',
    info: '',
    kind: 'f',
    abbr: 'drop(n: Int): List[Int]~' } ]

2019-05-01T10:46:57.842 DEBUG (pid:5636) [events] - Event: CompleteDone [ { word: 'flatMap',
    menu:
     '[B, That](f: Int => GenTraversableOnce[B])(implicit bf: CanBuildFrom[List[Int],B,That]): That [LS]',
    user_data:
     '{"cid":1556700414,"source":"languageserver.scalametals","index":0}',
    info: '',
    kind: 'f',
    abbr:
     'flatMap[B, That](f: Int => GenTraversableOnce[B])(implicit bf: CanBuildFrom[List[Int],B,That]): That~' } ]

In the first two cases the signature help is displayed but not in the last case.

Screenshots

Working as expected:

option-flatmap

Not working:

list-reduce

Thanks for looking into it and please let me know if I can help in any way.

gvolpe commented 5 years ago

Update: it was a bug in coc.nvim's parser, fixed in 0a0ab7c.

Summary

Here are all the reported labels that work:

And here the ones that don't:

It doesn't work because coc.nvim parses the values by comma (,), present in these labels.