Skip to content

Fix #104: Distinguish open declaration : #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export const scalaTmLanguage: TmLanguage = {
}
},
{
match: '\\b(trait)\\s+([^\\s\\{\\(\\[]+)',
match: `\\b(trait)\\s+([^\\s\\{\\(\\[;]+)(?<![^${opchar}]:)`,
captures: {
'1': {
name: 'keyword.declaration.scala'
Expand All @@ -568,7 +568,7 @@ export const scalaTmLanguage: TmLanguage = {
}
},
{
match: '\\b(?:(case|open)\\s+)?(class|object)\\s+([^\\s\\{\\(\\[;]+)',
match: `\\b(?:(case|open)\\s+)?(class|object)\\s+([^\\s\\{\\(\\[;]+)(?<![^${opchar}]:)`,
captures: {
'1': {
name: 'keyword.declaration.scala'
Expand Down
50 changes: 50 additions & 0 deletions tests/unit/#104.test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SYNTAX TEST "source.scala"


class Foo: // shares colour of stable identifier
// ^^^ entity.name.class.declaration
// ^ keyword.operator.scala

class Bar : // has same colour as declarations
// ^^^ entity.name.class.declaration
// ^ keyword.operator.scala

trait Foo:
// ^^^ entity.name.class.declaration
// ^ keyword.operator.scala

trait Bar :
// ^^^ entity.name.class.declaration
// ^ keyword.operator.scala

object Foo:
// ^^^ entity.name.class.declaration
// ^ keyword.operator.scala

object Bar :
// ^^^ entity.name.class.declaration
// ^ keyword.operator.scala

trait *:
// ^^ entity.name.class.declaration

trait *: :
// ^^ entity.name.class.declaration
// ^ keyword.operator.scala

trait :: :
// ^^ entity.name.class.declaration
// ^ keyword.operator.scala

class ::
// ^^ entity.name.class.declaration

class :: :
// ^^ entity.name.class.declaration
// ^ keyword.operator.scala

1 :: Nil
// ^^ keyword.operator.scala

1 ::
// ^^ keyword.operator.scala