File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
presentation-compiler/src/main/dotty/tools/pc/completions Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,20 @@ class ScalaCliCompletions(
1313):
1414 def unapply (path : List [Tree ]) =
1515 def scalaCliDep = CoursierComplete .isScalaCliDep(
16- pos.lineContent.take(pos.column).stripPrefix(" /*<script>*/" )
16+ pos.lineContent.take(pos.column).stripPrefix(" /*<script>*/" ).dropWhile(c => c == ' ' || c == ' \t ' )
1717 )
18+
19+ lazy val supportsUsing =
20+ val filename = pos.source.file.path
21+ filename.endsWith(" .sc.scala" ) ||
22+ filename.endsWith(" .worksheet.sc" )
23+
1824 path match
1925 case Nil | (_ : PackageDef ) :: _ => scalaCliDep
2026 // generated script file will end with .sc.scala
21- case (_ : TypeDef ) :: (_ : PackageDef ) :: Nil if pos.source.file.path.endsWith( " .sc.scala " ) =>
27+ case (_ : TypeDef ) :: (_ : PackageDef ) :: Nil if supportsUsing =>
2228 scalaCliDep
23- case (_ : Template ) :: (_ : TypeDef ) :: Nil if pos.source.file.path.endsWith( " .sc.scala " ) =>
29+ case (_ : Template ) :: (_ : TypeDef ) :: Nil if supportsUsing =>
2430 scalaCliDep
2531 case head :: next => None
2632
You can’t perform that action at this time.
0 commit comments