File tree Expand file tree Collapse file tree 3 files changed +34
-5
lines changed
src/main/dotty/tools/pc/completions
test/dotty/tools/pc/tests/completion Expand file tree Collapse file tree 3 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -243,21 +243,29 @@ class CompletionProvider(
243243 r match
244244 case IndexedContext .Result .InScope =>
245245 mkItem(
246- ident.backticked(backtickSoftKeyword) + completionTextSuffix
246+ v.insertText.getOrElse(
247+ ident.backticked(
248+ backtickSoftKeyword
249+ ) + completionTextSuffix
250+ ),
251+ range = v.range,
247252 )
248253 case _ if isInStringInterpolation =>
249254 mkItem(
250- " {" + sym.fullNameBackticked + completionTextSuffix + " }"
255+ " {" + sym.fullNameBackticked + completionTextSuffix + " }" ,
256+ range = v.range
251257 )
252258 case _ if v.isExtensionMethod =>
253259 mkItem(
254- ident.backticked(backtickSoftKeyword) + completionTextSuffix
260+ ident.backticked(backtickSoftKeyword) + completionTextSuffix,
261+ range = v.range
255262 )
256263 case _ =>
257264 mkItem(
258265 sym.fullNameBackticked(
259266 backtickSoftKeyword
260- ) + completionTextSuffix
267+ ) + completionTextSuffix,
268+ range = v.range
261269 )
262270 end match
263271 end match
Original file line number Diff line number Diff line change @@ -268,6 +268,7 @@ object CompletionValue:
268268 )(using Context ): String =
269269 if isExtension then s " ${printer.completionSymbol(symbol)} (extension) "
270270 else super .description(printer)
271+ override def isExtensionMethod : Boolean = isExtension
271272 end Interpolator
272273
273274 case class MatchCompletion (
Original file line number Diff line number Diff line change @@ -635,7 +635,7 @@ class CompletionInterpolatorSuite extends BaseCompletionSuite:
635635 |""" .stripMargin,
636636 """ |class Paths
637637 |object Main {
638- | s"this is an interesting {java.nio.file.Paths}"
638+ | s"this is an interesting $ {java.nio.file.Paths}"
639639 |}
640640 |""" .stripMargin,
641641 assertSingleItem = false ,
@@ -710,6 +710,26 @@ class CompletionInterpolatorSuite extends BaseCompletionSuite:
710710 filterText = " aaa.plus"
711711 )
712712
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+
713733 @ Test def `filter-by-type` =
714734 check(
715735 """ |package example
You can’t perform that action at this time.
0 commit comments