@@ -97,6 +97,8 @@ object Completion:
97
97
else if sel.isGiven && sel.bound.span.contains(pos.span) then Mode .ImportOrExport
98
98
else Mode .None // import scala.{util => u@@}
99
99
case GenericImportOrExport (_) => Mode .ImportOrExport | Mode .Scope // import TrieMa@@
100
+ case untpd.InterpolatedString (_, untpd.Literal (Constants .Constant (_ : String )) :: _) :: _ =>
101
+ Mode .Term | Mode .Scope
100
102
case untpd.Literal (Constants .Constant (_ : String )) :: _ => Mode .Term | Mode .Scope // literal completions
101
103
case (ref : untpd.RefTree ) :: _ =>
102
104
val maybeSelectMembers = if ref.isInstanceOf [untpd.Select ] then Mode .Member else Mode .Scope
@@ -171,6 +173,14 @@ object Completion:
171
173
case (importOrExport : untpd.ImportOrExport ) :: _ => Some (importOrExport)
172
174
case _ => None
173
175
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
+
174
184
/** Inspect `path` to determine the offset where the completion result should be inserted. */
175
185
def completionOffset (untpdPath : List [untpd.Tree ]): Int =
176
186
untpdPath match
@@ -221,7 +231,10 @@ object Completion:
221
231
// Ignore synthetic select from `This` because in code it was `Ident`
222
232
// See example in dotty.tools.languageserver.CompletionTest.syntheticThis
223
233
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)
225
238
case tpd.Select (qual, _) :: _ => Map .empty
226
239
case (tree : tpd.ImportOrExport ) :: _ => completer.directMemberCompletions(tree.expr)
227
240
case _ => completer.scopeCompletions
0 commit comments