-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Interactive] Include scope completions for synthic select tree #13515
Conversation
802facd
to
8a560b9
Compare
@@ -112,6 +112,9 @@ object Completion { | |||
val completer = new Completer(mode, prefix, pos) | |||
|
|||
val completions = path match { | |||
case Select(qual @ This(_), _) :: _ => | |||
val scope = if (qual.span.isSynthetic) completer.scopeCompletions else Map.empty |
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 would suggest moving this logic into the body of selectionCompletions
, leaving this match block here as it was - just as simple dispatching
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 simplified it a bit. Would it be ok to leave it here in this version?
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.
ok
8a560b9
to
5707140
Compare
case Import(expr, _) :: _ => completer.directMemberCompletions(expr) | ||
case (_: untpd.ImportSelector) :: Import(expr, _) :: _ => completer.directMemberCompletions(expr) | ||
case _ => completer.scopeCompletions | ||
case Select(qual @ This(_), _) :: _ if qual.span.isSynthetic => completer.scopeCompletions |
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.
Since it's non-obvious why this would be needed, I suggest adding a comment with an example here (or a reference to the added test case).
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.
Added
5707140
to
08aae18
Compare
Previously, in case if query matches on existing class member the returned completions were not returning symbols from scope. Fixes the following case: ```scala class Y { def bar: Unit = val argument: Int = 42 arg@@ // should return both `local.argument` and `this.arg` // but tree looks like select - `Select(This(Ident(Y)), Ident("arg"))` def arg: String = ??? } ```
08aae18
to
494094a
Compare
Previously, in case if query matches on existing class member
the returned completions were not returning symbols from scope.
Fixes the following case: