Skip to content

Fix #157: Highlight val with upper case #159

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
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
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})|(?=\\())`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can fix #153 with something like

          match: `\\b(?:(val)|(var))\\s+(?:((?:${idUpper}|${backQuotedId}|${plainid})(\\s*,\\s*(?:${idUpper}|${backQuotedId}|${plainid}))*)|(?=\\())`,

That can be done another PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. I will take a look at it.

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