Skip to content

Commit a399946

Browse files
committed
Contribute candidates when the selection is a Select
1 parent 67e6505 commit a399946

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-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
@@ -420,6 +420,20 @@ class Completions(
420420
),
421421
false,
422422
)
423+
case Select(_, name) :: (unapp : UnApply) :: _ =>
424+
(
425+
CaseKeywordCompletion.contribute(
426+
EmptyTree, // no selector
427+
completionPos,
428+
indexedContext,
429+
config,
430+
search,
431+
parent = unapp,
432+
autoImports,
433+
patternOnly = Some(name.decoded)
434+
),
435+
false,
436+
)
423437

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

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ object CaseKeywordCompletion:
9090
val argPts = UnapplyArgs(fn.tpe.widen.finalResultType, fn, patterns, parent.srcPos).argTypes
9191
patterns.zipWithIndex
9292
.find:
93-
case (id@Ident(v), tpe) => v.decoded == value
94-
case _ => false
93+
case (Ident(v), tpe) => v.decoded == value
94+
case (Select(_, v), tpe) => v.decoded == value
95+
case t => false
9596
.map((_, id) => argPts(id).widen.deepDealias)
9697
/* Parent is a function expecting a case match expression */
9798
case TreeApply(fun, _) if !fun.tpe.isErroneous =>

0 commit comments

Comments
 (0)