question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SignatureHelp gives apply of the current symbol instead of enclosing apply

See original GitHub issue

Compiler version

3.1.1

Explanation

I hit on this with Metals but then testing in Dotty with the SignatureHelp tests it suffers from the same issue, so the fix should probably be here.

Given the following code with the @@ signifying a trigger of the user to get signature help.

Li@@st(1, 2,  3)

The user will actually get the signature help of the apply on the List. That may not seem that problematic, but when you have something like this:

def doThing(myList: List[Int]) = ???

doThing(L@@ist(1, 2, 3))

The user is expecting to see the signature help for doThing, not the apply on List.

Example test

Here is what I used to test this:

  @Test def applyWhenYouDontWantIt: Unit = {
    val signature =
      S("apply[A]", Nil, List(List(P("elems", "A*"))), Some("CC[A]"))
    code"""|object O:
           |  def doThing(myList: List[Int]) = ???
           |  doThing(Li${m1}st(1, 2, 3)""".withSource
      .signatureHelp(m1, List(signature), Some(0), 0)
  }

Expectation

The test above will pass, when you really want it to fail and to be showing you the info for doThing meaning I care about the myList here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
tgodzikcommented, May 5, 2022

I think we should only show the signature help when we are inside parenthesis, which is where it’s most useful. The purpose of it is to be able to write the correct parameters. For just seeing the signature, we can use hover.

Isn’t the issue here that we don’t try to find the most recent enclosing apply, but use the identifier to calculate the signature help? We should make sure that we are actually inside the args.

1reaction
prolativcommented, Mar 11, 2022

Ok, I think I get it now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Signature help request · Issue #97 · rust-lang/rls - GitHub
We'd add a field to a Def for signature_help info or something (note that there is already Signature info, but we don't use...
Read more >
Language Server Protocol Specification - 3.17
This document describes the 3.17.x version of the language server protocol. An implementation for node of the 3.17.x version of the protocol can...
Read more >
Features - LSP for Sublime Text
Sublime Text will show a Quick Panel where you can select a symbol from the current buffer. This package provides a replacement if...
Read more >
utils/vscode/src/lsp/protocol/tsprotocol.go - Google Git
An optional token that a server can use to report work done progress. */. WorkDoneToken *ProgressToken `json:"workDoneToken,omitempty"`.
Read more >
Go To Definition in the Language Server Protocol - Strumenta
This is the editor command that allows us to quickly find where a symbol is ... Or, we can use yarn or other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found