Skip to content

Commit

Permalink
Highlight val with upper case
Browse files Browse the repository at this point in the history
  • Loading branch information
camilaagw committed Dec 4, 2020
1 parent b3d18b4 commit 76605c1
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
14 changes: 1 addition & 13 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,19 +668,7 @@ export const scalaTmLanguage: TmLanguage = {
}
},
{
match: `\\b(val)\\s+(${idUpper}(\\s*,\\s*${idUpper})*)\\b`,
captures: {
'1': {
name: 'keyword.declaration.stable.scala'
}
,
'2': {
name: 'constant.other.declaration.scala'
}
}
},
{
match: `\\b(?:(val)|(var))\\s+(?:(${backQuotedId}|${plainid})|(?=\\())`,
match: `\\b(?:(val)|(var))\\s+(?:(${idUpper}(\\s*,\\s*${idUpper})*|${backQuotedId}|${plainid})|(?=\\())`,
captures: {
'1': {
name: 'keyword.declaration.stable.scala'
Expand Down
2 changes: 1 addition & 1 deletion tests/snap/lexical.test.scala.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#^^ source.scala
# ^^^ source.scala keyword.declaration.stable.scala
# ^ source.scala
# ^^^^^^ source.scala constant.other.declaration.scala
# ^^^^^^ source.scala variable.other.declaration.scala
# ^ source.scala
# ^ source.scala keyword.operator.comparison.scala
# ^ source.scala
Expand Down
2 changes: 1 addition & 1 deletion tests/snap/scala_spec.test.scala.snap
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@
#^^ source.scala
# ^^^ source.scala keyword.declaration.stable.scala
# ^ source.scala
# ^^^^ source.scala constant.other.declaration.scala
# ^^^^ source.scala variable.other.declaration.scala
# ^ source.scala meta.bracket.scala
# ^ source.scala
# ^ source.scala meta.bracket.scala
Expand Down
23 changes: 23 additions & 0 deletions tests/unit/#157.test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SYNTAX TEST "source.scala"

val Foo = ???
// ^^^ keyword.declaration.stable.scala
// ^^^ variable.other.declaration.scala

val foo = ???
// ^^^ keyword.declaration.stable.scala
// ^^^ variable.other.declaration.scala

var Foo = ???
// ^^^ keyword.declaration.volatile.scala
// ^^^ variable.other.declaration.scala

var foo = ???
// ^^^ keyword.declaration.volatile.scala
// ^^^ variable.other.declaration.scala

def Foo = ???
// ^^^ entity.name.function.declaration

def foo
// ^^^ entity.name.function.declaration
6 changes: 3 additions & 3 deletions tests/unit/#51.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
object Enum extends Enumeration {
val Foo, Bar, Baz = Value
// ^^^ keyword.declaration.stable.scala
// ^^^ constant.other.declaration.scala
// ^^^ constant.other.declaration.scala
// ^^^ constant.other.declaration.scala
// ^^^ variable.other.declaration.scala
// ^^^ variable.other.declaration.scala
// ^^^ variable.other.declaration.scala
// ^^^^^ entity.name.class

}
4 changes: 2 additions & 2 deletions tests/unit/unicode.identifiers.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ class Φδφκξ(x : Int, δφξκξ: Int, val y: Int, val φξ: Int) {

val Constant = 3
//^^^ keyword.declaration.stable.scala
// ^^^^^^^^ constant.other.declaration.scala
// ^^^^^^^^ variable.other.declaration.scala
// ^ keyword.operator.comparison.scala
val Константа = 4
//^^^ keyword.declaration.stable.scala
// ^^^^^^^^^ constant.other.declaration.scala
// ^^^^^^^^^ variable.other.declaration.scala
// ^ keyword.operator.comparison.scala

}
Expand Down

0 comments on commit 76605c1

Please sign in to comment.