Skip to content

Commit

Permalink
Highlight illegal $ as end of string
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Jan 29, 2021
1 parent 6d3de7b commit b28000b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
14 changes: 4 additions & 10 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export const scalaTmLanguage: TmLanguage = {
},
{
begin: `\\b(raw)(")`,
end: `(")|(\\$(?=[^\\$"_{${letterChars}]))`,
end: `"|\\$(?=[^\\$"_{${letterChars}])`,
beginCaptures: {
'1': {
name: 'keyword.interpolation.scala'
Expand All @@ -441,17 +441,14 @@ export const scalaTmLanguage: TmLanguage = {
}
],
endCaptures: {
'1': {
'0': {
name: 'string.quoted.double.interpolated.scala punctuation.definition.string.end.scala'
},
'2': {
name: 'invalid.illegal.unrecognized-string-escape.scala'
}
}
},
{
begin: `\\b(${alphaId})(")`,
end: `(")|(\\$(?=[^\\$"_{${letterChars}]))`,
end: `"|\\$(?=[^\\$"_{${letterChars}])`,
beginCaptures: {
'1': {
name: 'keyword.interpolation.scala'
Expand Down Expand Up @@ -482,11 +479,8 @@ export const scalaTmLanguage: TmLanguage = {
}
],
endCaptures: {
'1': {
'0': {
name: 'string.quoted.double.interpolated.scala punctuation.definition.string.end.scala'
},
'2': {
name: 'invalid.illegal.unrecognized-string-escape.scala'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/#183.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@
raw"$
// ^^^ source.scala keyword.interpolation.scala
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala
// ^ invalid.illegal.unrecognized-string-escape.scala
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala
6 changes: 3 additions & 3 deletions tests/unit/#195.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@

s"$ //
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala
// ^ invalid.illegal.unrecognized-string-escape.scala
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala
// ^^ comment.line.double-slash.scala punctuation.definition.comment.scala

s"$+
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala
// ^ invalid.illegal.unrecognized-string-escape.scala
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala
// ^ keyword.operator.arithmetic.scala

s"$; val a =
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala
// ^ invalid.illegal.unrecognized-string-escape.scala
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala
// ^^^^^^^^^^ -string.quoted.double.interpolated.scala
// ^^^ keyword.declaration.stable.scala

0 comments on commit b28000b

Please sign in to comment.