-
Notifications
You must be signed in to change notification settings - Fork 1.1k
SignatureHelp gives apply of the current symbol instead of enclosing apply #14661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I was a bit confused reading this, do you mean you still want to see the |
No, I mean in the situation for Whereas with Scala 3 triggering a signature help in the same position instead gives me the signature for the |
Yeah, I didn't get it like this at the first moment either. So even in a case like val x = foo1(foo2(foo3(foo4(foo5(0))))) when you hover on |
In Scala 2 the way that it's set up in Metals is that it will also go to the closest enclosing apply. So in the situation you have @prolativ if you triggered a signature help like so: val x = foo1(foo2(foo3(foo4(fo${m1}o5(0))))) This apply you actually care about would be the closest enclosing one meaning Whereas currently in Scala 3 this shows: However this isn't what is desired. The only time the signature for val x = foo1(foo2(foo3(foo4(foo5(${m1}))))) Does this make sense? |
Furthermore, this behavior also leads to other issues. For example def doThing(myList: List[Int], second: Int) = ???
do${m1}Thing(List(1,2,3), 2) Will result in: Notice how it shows the second parameter is the current one? Signature help in this scenario shouldn't return anything since you're not in an apply. You see the same thing whenever you try to trigger it on |
Ok, I think I get it now |
@ckipp01 Should we remove signatureHelp when its triggered by position on toplevel function name such as |
So I'm most familiar with Metals and not sure how this works with other tooling, but in the scenario where the user triggers a signature help on |
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. |
Uh oh!
There was an error while loading. Please reload this page.
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.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:
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:
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.The text was updated successfully, but these errors were encountered: