From 76605c1370cd69a998bd6bbb4cf18ad488eb1e78 Mon Sep 17 00:00:00 2001 From: Camila Andrea Gonzalez Williamson Date: Fri, 4 Dec 2020 09:45:51 +0100 Subject: [PATCH] Highlight `val` with upper case --- src/typescript/Scala.tmLanguage.ts | 14 +------------- tests/snap/lexical.test.scala.snap | 2 +- tests/snap/scala_spec.test.scala.snap | 2 +- tests/unit/#157.test.scala | 23 +++++++++++++++++++++++ tests/unit/#51.test.scala | 6 +++--- tests/unit/unicode.identifiers.test.scala | 4 ++-- 6 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 tests/unit/#157.test.scala diff --git a/src/typescript/Scala.tmLanguage.ts b/src/typescript/Scala.tmLanguage.ts index 85784b7..2e4e36c 100644 --- a/src/typescript/Scala.tmLanguage.ts +++ b/src/typescript/Scala.tmLanguage.ts @@ -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' diff --git a/tests/snap/lexical.test.scala.snap b/tests/snap/lexical.test.scala.snap index 5edbf5f..e7bbaf6 100644 --- a/tests/snap/lexical.test.scala.snap +++ b/tests/snap/lexical.test.scala.snap @@ -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 diff --git a/tests/snap/scala_spec.test.scala.snap b/tests/snap/scala_spec.test.scala.snap index ebe67b1..3897eb5 100644 --- a/tests/snap/scala_spec.test.scala.snap +++ b/tests/snap/scala_spec.test.scala.snap @@ -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 diff --git a/tests/unit/#157.test.scala b/tests/unit/#157.test.scala new file mode 100644 index 0000000..51b1de4 --- /dev/null +++ b/tests/unit/#157.test.scala @@ -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 diff --git a/tests/unit/#51.test.scala b/tests/unit/#51.test.scala index c72afb3..14f4a27 100644 --- a/tests/unit/#51.test.scala +++ b/tests/unit/#51.test.scala @@ -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 } diff --git a/tests/unit/unicode.identifiers.test.scala b/tests/unit/unicode.identifiers.test.scala index 0821794..542b59a 100644 --- a/tests/unit/unicode.identifiers.test.scala +++ b/tests/unit/unicode.identifiers.test.scala @@ -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 }