Skip to content

Commit b2f11b9

Browse files
Merge pull request #88 from nicolasstucki/support-using-soft-keyword
Support `using` soft keyword
2 parents e293826 + fb1cfbf commit b2f11b9

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/typescript/Scala.tmLanguage.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ export const scalaTmLanguage: TmLanguage = {
230230
{
231231
include: '#keywords'
232232
},
233+
{
234+
include: '#using'
235+
},
233236
{
234237
include: '#constants'
235238
},
@@ -385,6 +388,18 @@ export const scalaTmLanguage: TmLanguage = {
385388
}
386389
]
387390
},
391+
'using': {
392+
patterns: [
393+
{
394+
match: `\\(\\s*(using)`,
395+
captures: {
396+
'1': {
397+
name: 'keyword.declaration.scala'
398+
}
399+
}
400+
}
401+
]
402+
},
388403
'string-interpolation': {
389404
patterns: [
390405
{

tests/unit/using.test.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SYNTAX TEST "source.scala"
2+
3+
def f(using x: Int): Unit = ()
4+
// ^^^^^ keyword.declaration.scala
5+
6+
f(using 2)
7+
// ^^^^^ keyword.declaration.scala
8+
// ^ constant.numeric.scala
9+
10+
class A(using x: Int)
11+
// ^^^^^ keyword.declaration.scala
12+
13+
new A(using 3)
14+
// ^^^^^ keyword.declaration.scala
15+
// ^ constant.numeric.scala
16+
17+
given [T](using x: Ord[T], using: Int) as Ord[List[T]]
18+
// ^^^^^ keyword.declaration.scala
19+
// ^ variable.parameter.scala
20+
// ^^^^^ variable.parameter.scala
21+
22+
given [T](using Ord[T]) as Ord[List[T]]
23+
// ^^^^^ keyword.declaration.scala

0 commit comments

Comments
 (0)