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: Don't show completions with case class members #5324

Merged
merged 1 commit into from Jun 27, 2023

Conversation

jkciesluk
Copy link
Member

I can't think of any other case when we don't want to see case class members, so it was easier to change it directly in completions, instead of changing includeMembers in ScalaToplevelMtags

solves #5289

@@ -578,6 +578,7 @@ class Completions(
indexedContext.lookupSym(sym) match
case IndexedContext.Result.InScope =>
visit(CompletionValue.scope(sym.decodedName, sym))
case _ if sym.maybeOwner.is(Flags.CaseClass) => true
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't make sense for any class not just case class but never happens for anything else, I am understanding it right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out it happens more ofter. We are indexing also members of case class/class/trait etc. but we don't filter them out for completions, and they can't be brought to scope via import. I changed isAccessible, which should solve this issue

@@ -394,7 +394,6 @@ class CompletionSnippetSuite extends BaseCompletionSuite {
"3" ->
"""|Try
|Try($0)
|TryMethods
Copy link
Member Author

Choose a reason for hiding this comment

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

I believe this completion was incorrect, since it a member of a trait?

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!

@jkciesluk jkciesluk merged commit 6e9bca7 into scalameta:main Jun 27, 2023
23 of 24 checks passed
@jkciesluk jkciesluk deleted the i5289 branch June 27, 2023 09:00
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.

None yet

3 participants