File tree 3 files changed +34
-5
lines changed
src/main/dotty/tools/pc/completions
test/dotty/tools/pc/tests/completion
3 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -243,21 +243,29 @@ class CompletionProvider(
243
243
r match
244
244
case IndexedContext .Result .InScope =>
245
245
mkItem(
246
- ident.backticked(backtickSoftKeyword) + completionTextSuffix
246
+ v.insertText.getOrElse(
247
+ ident.backticked(
248
+ backtickSoftKeyword
249
+ ) + completionTextSuffix
250
+ ),
251
+ range = v.range,
247
252
)
248
253
case _ if isInStringInterpolation =>
249
254
mkItem(
250
- " {" + sym.fullNameBackticked + completionTextSuffix + " }"
255
+ " {" + sym.fullNameBackticked + completionTextSuffix + " }" ,
256
+ range = v.range
251
257
)
252
258
case _ if v.isExtensionMethod =>
253
259
mkItem(
254
- ident.backticked(backtickSoftKeyword) + completionTextSuffix
260
+ ident.backticked(backtickSoftKeyword) + completionTextSuffix,
261
+ range = v.range
255
262
)
256
263
case _ =>
257
264
mkItem(
258
265
sym.fullNameBackticked(
259
266
backtickSoftKeyword
260
- ) + completionTextSuffix
267
+ ) + completionTextSuffix,
268
+ range = v.range
261
269
)
262
270
end match
263
271
end match
Original file line number Diff line number Diff line change @@ -268,6 +268,7 @@ object CompletionValue:
268
268
)(using Context ): String =
269
269
if isExtension then s " ${printer.completionSymbol(symbol)} (extension) "
270
270
else super .description(printer)
271
+ override def isExtensionMethod : Boolean = isExtension
271
272
end Interpolator
272
273
273
274
case class MatchCompletion (
Original file line number Diff line number Diff line change @@ -635,7 +635,7 @@ class CompletionInterpolatorSuite extends BaseCompletionSuite:
635
635
|""" .stripMargin,
636
636
""" |class Paths
637
637
|object Main {
638
- | s"this is an interesting {java.nio.file.Paths}"
638
+ | s"this is an interesting $ {java.nio.file.Paths}"
639
639
|}
640
640
|""" .stripMargin,
641
641
assertSingleItem = false ,
@@ -710,6 +710,26 @@ class CompletionInterpolatorSuite extends BaseCompletionSuite:
710
710
filterText = " aaa.plus"
711
711
)
712
712
713
+
714
+ @ Test def `extension3` =
715
+ checkEdit(
716
+ """ |trait Cursor
717
+ |
718
+ |extension (c: Cursor) def spelling: String = "hello"
719
+ |object Main {
720
+ | val c = new Cursor {}
721
+ | val x = s"$c.spelli@@"
722
+ |}
723
+ |""" .stripMargin,
724
+ """ |trait Cursor
725
+ |
726
+ |extension (c: Cursor) def spelling: String = "hello"
727
+ |object Main {
728
+ | val c = new Cursor {}
729
+ | val x = s"${c.spelling$0}"
730
+ |}""" .stripMargin
731
+ )
732
+
713
733
@ Test def `filter-by-type` =
714
734
check(
715
735
""" |package example
You can’t perform that action at this time.
0 commit comments