@@ -95,6 +95,8 @@ object Completion:
9595 else if sel.isGiven && sel.bound.span.contains(pos.span) then Mode .ImportOrExport
9696 else Mode .None // import scala.{util => u@@}
9797 case GenericImportOrExport (_) => Mode .ImportOrExport | Mode .Scope // import TrieMa@@
98+ case untpd.InterpolatedString (_, untpd.Literal (Constants .Constant (_ : String )) :: _) :: _ =>
99+ Mode .Term | Mode .Scope
98100 case untpd.Literal (Constants .Constant (_ : String )) :: _ => Mode .Term | Mode .Scope // literal completions
99101 case (ref : untpd.RefTree ) :: _ =>
100102 val maybeSelectMembers = if ref.isInstanceOf [untpd.Select ] then Mode .Member else Mode .Scope
@@ -169,6 +171,14 @@ object Completion:
169171 case (importOrExport : untpd.ImportOrExport ) :: _ => Some (importOrExport)
170172 case _ => None
171173
174+ private object StringContextApplication :
175+ def unapply (path : List [tpd.Tree ]): Option [tpd.Apply ] =
176+ path match
177+ case tpd.Select (qual @ tpd.Apply (tpd.Select (tpd.Select (_, StdNames .nme.StringContext ), _), _), _) :: _ =>
178+ Some (qual)
179+ case _ => None
180+
181+
172182 /** Inspect `path` to determine the offset where the completion result should be inserted. */
173183 def completionOffset (untpdPath : List [untpd.Tree ]): Int =
174184 untpdPath match
@@ -218,7 +228,10 @@ object Completion:
218228 // Ignore synthetic select from `This` because in code it was `Ident`
219229 // See example in dotty.tools.languageserver.CompletionTest.syntheticThis
220230 case tpd.Select (qual @ tpd.This (_), _) :: _ if qual.span.isSynthetic => completer.scopeCompletions
221- case tpd.Select (qual, _) :: _ if qual.typeOpt.hasSimpleKind => completer.selectionCompletions(qual)
231+ case StringContextApplication (qual) =>
232+ completer.scopeCompletions ++ completer.selectionCompletions(qual)
233+ case tpd.Select (qual, _) :: _ if qual.typeOpt.hasSimpleKind =>
234+ completer.selectionCompletions(qual)
222235 case tpd.Select (qual, _) :: _ => Map .empty
223236 case (tree : tpd.ImportOrExport ) :: _ => completer.directMemberCompletions(tree.expr)
224237 case _ => completer.scopeCompletions
0 commit comments