Skip to content

Commit

Permalink
Support using soft keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Jun 26, 2020
1 parent 6c995f9 commit fb1cfbf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ export const scalaTmLanguage: TmLanguage = {
{
include: '#keywords'
},
{
include: '#using'
},
{
include: '#constants'
},
Expand Down Expand Up @@ -320,6 +323,18 @@ export const scalaTmLanguage: TmLanguage = {
}
]
},
'using': {
patterns: [
{
match: `\\(\\s*(using)`,
captures: {
'1': {
name: 'keyword.declaration.scala'
}
}
}
]
},
'string-interpolation': {
patterns: [
{
Expand Down
23 changes: 23 additions & 0 deletions tests/unit/using.test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SYNTAX TEST "source.scala"

def f(using x: Int): Unit = ()
// ^^^^^ keyword.declaration.scala

f(using 2)
// ^^^^^ keyword.declaration.scala
// ^ constant.numeric.scala

class A(using x: Int)
// ^^^^^ keyword.declaration.scala

new A(using 3)
// ^^^^^ keyword.declaration.scala
// ^ constant.numeric.scala

given [T](using x: Ord[T], using: Int) as Ord[List[T]]
// ^^^^^ keyword.declaration.scala
// ^ variable.parameter.scala
// ^^^^^ variable.parameter.scala

given [T](using Ord[T]) as Ord[List[T]]
// ^^^^^ keyword.declaration.scala

0 comments on commit fb1cfbf

Please sign in to comment.