Skip to content

Commit

Permalink
Support extension clause
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Jun 29, 2020
1 parent 6c995f9 commit 0690707
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ export const scalaTmLanguage: TmLanguage = {
{
include: '#inheritance'
},
{
include: '#extension'
},
{
include: '#imports'
},
Expand Down Expand Up @@ -859,6 +862,19 @@ export const scalaTmLanguage: TmLanguage = {
}
]
},
extension: {
patterns: [
{
match: `(extension)\\s+(?=[\\[\\(])`,
captures: {
'1': {
name: 'keyword.declaration.scala'
},

}
}
]
},
'parameter-list': {
patterns: [
{
Expand Down
19 changes: 19 additions & 0 deletions tests/unit/extension.test.scala
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0690707

Please sign in to comment.