@@ -97,6 +97,8 @@ object Completion:
9797 else if sel.isGiven && sel.bound.span.contains(pos.span) then Mode .ImportOrExport
9898 else Mode .None // import scala.{util => u@@}
9999 case GenericImportOrExport (_) => Mode .ImportOrExport | Mode .Scope // import TrieMa@@
100+ case untpd.InterpolatedString (_, untpd.Literal (Constants .Constant (_ : String )) :: _) :: _ =>
101+ Mode .Term | Mode .Scope
100102 case untpd.Literal (Constants .Constant (_ : String )) :: _ => Mode .Term | Mode .Scope // literal completions
101103 case (ref : untpd.RefTree ) :: _ =>
102104 val maybeSelectMembers = if ref.isInstanceOf [untpd.Select ] then Mode .Member else Mode .Scope
@@ -171,6 +173,14 @@ object Completion:
171173 case (importOrExport : untpd.ImportOrExport ) :: _ => Some (importOrExport)
172174 case _ => None
173175
176+ private object StringContextApplication :
177+ def unapply (path : List [tpd.Tree ]): Option [tpd.Apply ] =
178+ path match
179+ case tpd.Select (qual @ tpd.Apply (tpd.Select (tpd.Select (_, StdNames .nme.StringContext ), _), _), _) :: _ =>
180+ Some (qual)
181+ case _ => None
182+
183+
174184 /** Inspect `path` to determine the offset where the completion result should be inserted. */
175185 def completionOffset (untpdPath : List [untpd.Tree ]): Int =
176186 untpdPath match
@@ -221,7 +231,10 @@ object Completion:
221231 // Ignore synthetic select from `This` because in code it was `Ident`
222232 // See example in dotty.tools.languageserver.CompletionTest.syntheticThis
223233 case tpd.Select (qual @ tpd.This (_), _) :: _ if qual.span.isSynthetic => completer.scopeCompletions
224- case tpd.Select (qual, _) :: _ if qual.typeOpt.hasSimpleKind => completer.selectionCompletions(qual)
234+ case StringContextApplication (qual) =>
235+ completer.scopeCompletions ++ completer.selectionCompletions(qual)
236+ case tpd.Select (qual, _) :: _ if qual.typeOpt.hasSimpleKind =>
237+ completer.selectionCompletions(qual)
225238 case tpd.Select (qual, _) :: _ => Map .empty
226239 case (tree : tpd.ImportOrExport ) :: _ => completer.directMemberCompletions(tree.expr)
227240 case _ => completer.scopeCompletions
0 commit comments