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
Conversation
@@ -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 |
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.
It doesn't make sense for any class not just case class
but never happens for anything else, I am understanding it right?
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.
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
b4b80b5
to
e5e7afd
Compare
@@ -394,7 +394,6 @@ class CompletionSnippetSuite extends BaseCompletionSuite { | |||
"3" -> | |||
"""|Try | |||
|Try($0) | |||
|TryMethods |
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.
I believe this completion was incorrect, since it a member of a trait?
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!
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
inScalaToplevelMtags
solves #5289