diff --git a/src/typescript/Scala.tmLanguage.ts b/src/typescript/Scala.tmLanguage.ts index e7338f2..2e4a1fd 100644 --- a/src/typescript/Scala.tmLanguage.ts +++ b/src/typescript/Scala.tmLanguage.ts @@ -1017,7 +1017,7 @@ export const scalaTmLanguage: TmLanguage = { inheritance: { patterns: [ { - match: `(extends|with|derives)\\s+(${idUpper}|${backQuotedId}|(?=\\([^\\)]+=>)|(?=${plainid})|(?="))`, + match: `\\b(extends|with|derives)\\b\\s*(${idUpper}|${backQuotedId}|(?=\\([^\\)]+=>)|(?=${plainid})|(?="))?`, captures: { '1': { name: 'keyword.declaration.scala' diff --git a/tests/unit/#156.test.scala b/tests/unit/#156.test.scala new file mode 100644 index 0000000..541dfd4 --- /dev/null +++ b/tests/unit/#156.test.scala @@ -0,0 +1,55 @@ +// SYNTAX TEST "source.scala" + + + class Foo extends +// ^^^^^ keyword.declaration.scala +// ^^^ entity.name.class.declaration +// ^^^^^^^ keyword.declaration.scala + + class Foo extends Bar with Baz +// ^^^^^ keyword.declaration.scala +// ^^^ entity.name.class.declaration +// ^^^^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala +// ^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala + + class Foo extends Bar with +// ^^^^^ keyword.declaration.scala +// ^^^ entity.name.class.declaration +// ^^^^^^^ keyword.declaration.scala +// ^^^ entity.other.inherited-class.scala +// ^^^^ keyword.declaration.scala + + + given tc: TC with {} +// ^^^^^ keyword.declaration.scala +// ^^ variable.parameter.scala +// ^^ entity.name.class +// ^^^^ keyword.declaration.scala + + given Liftable[Boolean] with { +// ^^^^^ keyword.declaration.scala +// ^^^^^^^^ entity.name.class +// ^^^^^^^ entity.name.class +// ^^^^ keyword.declaration.scala + + given listMonad: Monad[List] with +// ^^^^^ keyword.declaration.scala +// ^^^^^^^^^ variable.parameter.scala +// ^^^^^ entity.name.class +// ^^^^ entity.name.class +// ^^^^ keyword.declaration.scala + + enum Opt[+T] derives Eq { +// ^^^^ keyword.declaration.scala +// ^^^ entity.name.class.declaration +// ^ entity.name.class +// ^^^^^^^ keyword.declaration.scala +// ^^ entity.other.inherited-class.scala + + enum Opt[+T] derives +// ^^^^ keyword.declaration.scala +// ^^^ entity.name.class.declaration +// ^ entity.name.class +// ^^^^^^^ keyword.declaration.scala