-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use untpd.Tree instead of tpd.Tree for SelectionRangeProvider #22702
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
Use untpd.Tree instead of tpd.Tree for SelectionRangeProvider #22702
Conversation
And this is PR that would fix this issue if we didn't migrate to untpd trees: #22703 |
def toSelectionRange(srcPos: SourcePosition) = | ||
val selectionRange = new SelectionRange() | ||
selectionRange.setRange(srcPos.toLsp) | ||
selectionRange | ||
|
||
val treeSelectionRange = toSelectionRange(tree.sourcePos) | ||
|
||
def getArgsSpan(args: List[Tree]): Option[SourcePosition] = | ||
args match | ||
case Seq(param) => Some(param.sourcePos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? Won't it repeat the same selection? Can you add a test with a single param?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rochala do you need help finishing this one?
"Apropos of nothing", this is an example where I don't know where to fetch from, because of
It would be nice if github accommodated either specification (on cloned repos). |
I don't have context for the previous comment Edit: I'm not sure if |
In this PR (current PR) @rochala switches from using typed trees to untyped ones for selection provider. This both fixes the issue with parentheses (#22566) and generally makes more sense, since untyped trees (vs typed ones) closely resemble the structure of the source code. My understanding is that if we didn't make that switch the other PR (#22703) contains an alternative solution. @rochala, does this mean that this PR supersedes #22703? |
No, they are 2 different bugfixes. |
ping |
Co-authored-by: NPCRUS <[email protected]> Co-authored-by: Yummy-Yums <[email protected]>
0dc2e28
to
af12fac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…22702) Thanks to @NPCRUS @Yummy-Yums for taking a part in a spree. Sorry for taking that long to create a PR, but I was unavailable. Fixes scala#22566 --------- Co-authored-by: NPCRUS <[email protected]> Co-authored-by: Yummy-Yums <[email protected]>
…22702) Thanks to @NPCRUS @Yummy-Yums for taking a part in a spree. Sorry for taking that long to create a PR, but I was unavailable. Fixes scala#22566 --------- Co-authored-by: NPCRUS <[email protected]> Co-authored-by: Yummy-Yums <[email protected]> [Cherry-picked 107a2f1][modified]
…22702) Thanks to @NPCRUS @Yummy-Yums for taking a part in a spree. Sorry for taking that long to create a PR, but I was unavailable. Fixes scala#22566 --------- Co-authored-by: NPCRUS <[email protected]> Co-authored-by: Yummy-Yums <[email protected]>
Thanks to @NPCRUS @Yummy-Yums for taking a part in a spree. Sorry for taking that long to create a PR, but I was unavailable.
Fixes #22566