SignatureHelp gives apply of the current symbol instead of enclosing apply
See original GitHub issueCompiler 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:
- Created 2 years ago
- Comments:9 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Ok, I think I get it now