diff --git a/src/typescript/Scala.tmLanguage.ts b/src/typescript/Scala.tmLanguage.ts index 80870a0..812fa98 100644 --- a/src/typescript/Scala.tmLanguage.ts +++ b/src/typescript/Scala.tmLanguage.ts @@ -168,6 +168,9 @@ export const scalaTmLanguage: TmLanguage = { { include: '#keywords' }, + { + include: '#using' + }, { include: '#constants' }, @@ -320,6 +323,18 @@ export const scalaTmLanguage: TmLanguage = { } ] }, + 'using': { + patterns: [ + { + match: `\\(\\s*(using)`, + captures: { + '1': { + name: 'keyword.declaration.scala' + } + } + } + ] + }, 'string-interpolation': { patterns: [ { diff --git a/tests/unit/using.test.scala b/tests/unit/using.test.scala new file mode 100644 index 0000000..546cc4d --- /dev/null +++ b/tests/unit/using.test.scala @@ -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