Skip to content

Commit

Permalink
Fix #124: Identify extended class names as identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Jul 9, 2020
1 parent 7900e8d commit 8aad5cd
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ export const scalaTmLanguage: TmLanguage = {
inheritance: {
patterns: [
{
match: '(extends|with|derives)\\s+([^\\s\\(\\{\\[\\]\\)\\};"]+|(?=\\([^\\)]+=>)|(?="))',
match: `(extends|with|derives)\\s+(${plainid}|${backQuotedId}|(?=\\([^\\)]+=>)|(?="))`,
captures: {
'1': {
name: 'keyword.declaration.scala'
Expand Down
65 changes: 65 additions & 0 deletions tests/unit/#124.test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SYNTAX TEST "source.scala"

def foo(x: A with B, c: C): Int = 0
// ^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A with B,
// ^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A with B:
// ^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A:
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A,
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A'
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ punctuation.definition.character.begin.scala

class B extends A|
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A+
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A-
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A*
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A&
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends A^
// ^^^^^^^ keyword.declaration.scala
// ^ entity.other.inherited-class.scala
// ^ source.scala

class B extends `A`
// ^^^^^^^ keyword.declaration.scala
// ^^^ entity.other.inherited-class.scala

0 comments on commit 8aad5cd

Please sign in to comment.