Skip to content

add selection ranges for more names #23257

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zielinsky
Copy link

@zielinsky zielinsky commented May 23, 2025

Add selection ranges for more names.

Porting scalameta/metals#7446

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! I have some questions about some of the changes.

case vdef @ ValDef(_, tpt, _) =>
maybeToSelectionRange(vdef.namePos)
++ maybeToSelectionRange(tpt.sourcePos)
++ maybeToSelectionRange(vdef.rhs.sourcePos)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need rhs? Wouldn't that already be added by the tree inside RHS? Same for tpt. untpdPath should give us all tree nodes on the way to the current position.

++ maybeToSelectionRange(vdef.rhs.sourcePos)
case tdef @ TypeDef(_, rhs) =>
maybeToSelectionRange(tdef.namePos)
++ maybeToSelectionRange(rhs.sourcePos)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, is there a test case this fixes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants