Skip to content

Commit a45260e

Browse files
Merge pull request #181 from nicolasstucki/fix-#180
Capture `using` followed by quote splice
2 parents ded2bf1 + f8dcd02 commit a45260e

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

src/typescript/Scala.tmLanguage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ export const scalaTmLanguage: TmLanguage = {
485485
'using': {
486486
patterns: [
487487
{
488-
match: `(?<=\\()\\s*(using)\\s+(?=[\\w\\d\\(\\.\\(\\{'"])`,
488+
match: `(?<=\\()\\s*(using)\\s`,
489489
captures: {
490490
'1': {
491491
name: 'keyword.declaration.scala'

tests/unit/#180.test.scala

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// SYNTAX TEST "source.scala"
2+
3+
case '{ Array[T]()(using $ct) } =>
4+
// ^^^^^ keyword.declaration.scala
5+
6+
case '{ Array[T]()(using ($ct: ClassTag[T])) } =>
7+
// ^^^^^ keyword.declaration.scala

tests/unit/using.test.scala

+17-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,20 @@ given [T](using Ord[T]) as Ord[List[T]]
4141

4242
f(using "")
4343
// ^^^^^ keyword.declaration.scala
44-
// ^^ string.quoted.double.scala
44+
// ^^ string.quoted.double.scala
45+
46+
val using = ...
47+
// ^^^^^ - keyword.declaration.scala
48+
val using: X = ...
49+
// ^^^^^ - keyword.declaration.scala
50+
def using() = ...
51+
// ^^^^^ - keyword.declaration.scala
52+
53+
using(foo)
54+
// ^^^^^ - keyword.declaration.scala
55+
bar(using(foo))
56+
// ^^^^^ - keyword.declaration.scala
57+
bar(using.apply(foo))
58+
// ^^^^^ - keyword.declaration.scala
59+
using.apply(foo)
60+
// ^^^^^ - keyword.declaration.scala

0 commit comments

Comments
 (0)