From 06907075c55d274aa114f1e30094e91c7ee3ad34 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 26 Jun 2020 14:49:44 +0200 Subject: [PATCH] Support `extension` clause --- src/typescript/Scala.tmLanguage.ts | 16 ++++++++++++++++ tests/unit/extension.test.scala | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/unit/extension.test.scala diff --git a/src/typescript/Scala.tmLanguage.ts b/src/typescript/Scala.tmLanguage.ts index 80870a0..69a8bc9 100644 --- a/src/typescript/Scala.tmLanguage.ts +++ b/src/typescript/Scala.tmLanguage.ts @@ -150,6 +150,9 @@ export const scalaTmLanguage: TmLanguage = { { include: '#inheritance' }, + { + include: '#extension' + }, { include: '#imports' }, @@ -859,6 +862,19 @@ export const scalaTmLanguage: TmLanguage = { } ] }, + extension: { + patterns: [ + { + match: `(extension)\\s+(?=[\\[\\(])`, + captures: { + '1': { + name: 'keyword.declaration.scala' + }, + + } + } + ] + }, 'parameter-list': { patterns: [ { diff --git a/tests/unit/extension.test.scala b/tests/unit/extension.test.scala new file mode 100644 index 0000000..27685c8 --- /dev/null +++ b/tests/unit/extension.test.scala @@ -0,0 +1,19 @@ +// SYNTAX TEST "source.scala" + + extension (x: T) def combine (y: T): T +// ^^^^^^^^^ keyword.declaration.scala +// ^ variable.parameter.scala +// ^ meta.colon.scala +// ^ entity.name.class +// ^^^ keyword.declaration.scala +// ^^^^^^^ entity.name.function.declaration + + + extension [T](x: T) def combine (y: T): T +// ^^^^^^^^^ keyword.declaration.scala +// ^ entity.name.class +// ^ variable.parameter.scala +// ^ meta.colon.scala +// ^ entity.name.class +// ^^^ keyword.declaration.scala +// ^^^^^^^ entity.name.function.declaration