Skip to content
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

fix: colliding pattern and scope completions #7295

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

harpocrates
Copy link
Contributor

This ensures that scope-based completions show up in a pattern context, even if the symbol to complete is the same as the one underlying a pattern completion (see the underscore-and-object test added)

This is achieved by putting case pattern completions in a new completion member with its own dedup-ing id.

Although it turned out to not matter in this specific case, also fixed inverseSemanticdbSymbol incorrectly returning an object symbol for some class symbols. That tweak on its own didn't affect any test output.

fixes #7291

)
if (patternOnly.nonEmpty && name == pattern) {
Copy link
Contributor Author

@harpocrates harpocrates Mar 12, 2025

Choose a reason for hiding this comment

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

This is a case to ensure that in something like

Option(123) match {
  case No@@
}

you only see None once instead of once for something from match completions then again from the general scope completions. Said differently, this is an exception where we want the match completions and general scope completions to collide so we see only one of them.

This ensures that scope-based completions show up in a pattern context,
even if the symbol to complete is the same as the one underlying a
pattern completion (see the `underscore-and-object` test added)

This is achieved by putting case pattern completions in a new completion
member with its own dedup-ing `id`.

Although it turned out to not matter in this specific case, also fixed
`inverseSemanticdbSymbol` incorrectly returning an object symbol for
some class symbols. That tweak on its own didn't affect any test
output.
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.

LGTM thanks!

@tgodzik tgodzik merged commit b3f551d into scalameta:main Mar 13, 2025
24 of 25 checks passed
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.

Missing completion for object in pattern
2 participants