Skip to content

Commit 3d422cd

Browse files
committed
Contribute candidates when the selection is a Select
1 parent 3d70773 commit 3d422cd

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,20 @@ class Completions(
421421
),
422422
false,
423423
)
424+
case Select(_, name) :: (unapp : UnApply) :: _ =>
425+
(
426+
CaseKeywordCompletion.contribute(
427+
EmptyTree, // no selector
428+
completionPos,
429+
indexedContext,
430+
config,
431+
search,
432+
parent = unapp,
433+
autoImports,
434+
patternOnly = Some(name.decoded)
435+
),
436+
false,
437+
)
424438

425439
// class FooImpl extends Foo:
426440
// def x|

presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ object CaseKeywordCompletion:
8989
val argPts = unapplyArgs(fn.tpe.widen.finalResultType, fn, patterns, parent.srcPos)
9090
patterns.zipWithIndex
9191
.find:
92-
case (id@Ident(v), tpe) => v.decoded == value
93-
case _ => false
92+
case (Ident(v), tpe) => v.decoded == value
93+
case (Select(_, v), tpe) => v.decoded == value
94+
case t =>
95+
println(s"> $t")
96+
false
9497
.map((_, id) => argPts(id).widen.metalsDealias)
9598
/* Parent is a function expecting a case match expression */
9699
case TreeApply(fun, _) if !fun.tpe.isErroneous =>

0 commit comments

Comments
 (0)