Skip to content

Commit 76605c1

Browse files
committed
Highlight val with upper case
1 parent b3d18b4 commit 76605c1

6 files changed

+31
-20
lines changed

src/typescript/Scala.tmLanguage.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -668,19 +668,7 @@ export const scalaTmLanguage: TmLanguage = {
668668
}
669669
},
670670
{
671-
match: `\\b(val)\\s+(${idUpper}(\\s*,\\s*${idUpper})*)\\b`,
672-
captures: {
673-
'1': {
674-
name: 'keyword.declaration.stable.scala'
675-
}
676-
,
677-
'2': {
678-
name: 'constant.other.declaration.scala'
679-
}
680-
}
681-
},
682-
{
683-
match: `\\b(?:(val)|(var))\\s+(?:(${backQuotedId}|${plainid})|(?=\\())`,
671+
match: `\\b(?:(val)|(var))\\s+(?:(${idUpper}(\\s*,\\s*${idUpper})*|${backQuotedId}|${plainid})|(?=\\())`,
684672
captures: {
685673
'1': {
686674
name: 'keyword.declaration.stable.scala'

tests/snap/lexical.test.scala.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#^^ source.scala
1919
# ^^^ source.scala keyword.declaration.stable.scala
2020
# ^ source.scala
21-
# ^^^^^^ source.scala constant.other.declaration.scala
21+
# ^^^^^^ source.scala variable.other.declaration.scala
2222
# ^ source.scala
2323
# ^ source.scala keyword.operator.comparison.scala
2424
# ^ source.scala

tests/snap/scala_spec.test.scala.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@
949949
#^^ source.scala
950950
# ^^^ source.scala keyword.declaration.stable.scala
951951
# ^ source.scala
952-
# ^^^^ source.scala constant.other.declaration.scala
952+
# ^^^^ source.scala variable.other.declaration.scala
953953
# ^ source.scala meta.bracket.scala
954954
# ^ source.scala
955955
# ^ source.scala meta.bracket.scala

tests/unit/#157.test.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SYNTAX TEST "source.scala"
2+
3+
val Foo = ???
4+
// ^^^ keyword.declaration.stable.scala
5+
// ^^^ variable.other.declaration.scala
6+
7+
val foo = ???
8+
// ^^^ keyword.declaration.stable.scala
9+
// ^^^ variable.other.declaration.scala
10+
11+
var Foo = ???
12+
// ^^^ keyword.declaration.volatile.scala
13+
// ^^^ variable.other.declaration.scala
14+
15+
var foo = ???
16+
// ^^^ keyword.declaration.volatile.scala
17+
// ^^^ variable.other.declaration.scala
18+
19+
def Foo = ???
20+
// ^^^ entity.name.function.declaration
21+
22+
def foo
23+
// ^^^ entity.name.function.declaration

tests/unit/#51.test.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
object Enum extends Enumeration {
44
val Foo, Bar, Baz = Value
55
// ^^^ keyword.declaration.stable.scala
6-
// ^^^ constant.other.declaration.scala
7-
// ^^^ constant.other.declaration.scala
8-
// ^^^ constant.other.declaration.scala
6+
// ^^^ variable.other.declaration.scala
7+
// ^^^ variable.other.declaration.scala
8+
// ^^^ variable.other.declaration.scala
99
// ^^^^^ entity.name.class
1010

1111
}

tests/unit/unicode.identifiers.test.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class Φδφκξ(x : Int, δφξκξ: Int, val y: Int, val φξ: Int) {
5656

5757
val Constant = 3
5858
//^^^ keyword.declaration.stable.scala
59-
// ^^^^^^^^ constant.other.declaration.scala
59+
// ^^^^^^^^ variable.other.declaration.scala
6060
// ^ keyword.operator.comparison.scala
6161
val Константа = 4
6262
//^^^ keyword.declaration.stable.scala
63-
// ^^^^^^^^^ constant.other.declaration.scala
63+
// ^^^^^^^^^ variable.other.declaration.scala
6464
// ^ keyword.operator.comparison.scala
6565

6666
}

0 commit comments

Comments
 (0)