hrsh7th / cmp-nvim-lsp-signature-help

cmp-nvim-lsp-signature-help
584 stars 24 forks source link

Signature help stops appearing when assigning argument values by name #5

Closed KodyVB closed 2 years ago

KodyVB commented 2 years ago

I was trying this out with Pyright as my language server for Python files, and found that if I call a function defined as:

def foo(first: str, second: int, third: list):
    ...

like: foo('a', 2, []), then it works as expected, highlighting the next parameter after each comma. However, if I type out: foo(first='a',, then the help box stops appearing. Is there a way to make it so the help box doesn't disappear when trying to assign values to arguments like that, and perhaps use = as a key to have it search for that parameter to highlight since they can be out of order that way?

hrsh7th commented 2 years ago

First of all, Do you know what VSCode does in this situation?

This problem can be cmp-nvim-lsp-signature-help side but also can be an LSP side problem.

KodyVB commented 2 years ago

I don't use VS Code, so I'll walk through what I just did and the results:

  1. Install the open source build of vscode ("code" in Arch official repo)
  2. Accept default configurations on first load
  3. Go to extensions, download Pyright
  4. Go to existing project and start calling a function with multiple parameters like above
  5. Type foo(, it brings up a help box with first: str highlighted
  6. Type foo(second=, the highlight changes to second: int
  7. Type foo(second=1,, the hint box stays up but doesn't highlight anything
  8. Type foo(second=1, first=, the hint box highlights first: str
  9. Type foo(second=1, first='a',, the hint box remains, highlighting nothing again
  10. Type foo(second=1, first='a', third=, the hint box highlights third: list

So in VS Code it does work for the most part - the only thing that would be missing would be it highlighting the first unused parameter, which I'm guessing that's a Pyright problem. But the hint box remaining and highlighting the parameter once the user types the variable name is desired.

mkarbo commented 2 years ago

I concur, this is what is stopping me from using this :(