Skip to content

SignatureHelp gives apply of the current symbol instead of enclosing apply #14661

Closed
@ckipp01

Description

@ckipp01

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions