Skip to content

Commit

Permalink
Fix opening paren matches with closing paren in character literal
Browse files Browse the repository at this point in the history
  • Loading branch information
PanAeon committed Jun 29, 2019
1 parent fbce6dd commit b3bbdf0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ export const scalaTmLanguage: TmLanguage = {
name: 'punctuation.definition.character.end.scala'
}
},
name: 'constant.character.literal.scala'
name: 'string.quoted.other constant.character.literal.scala'
},
initialization: {
match: '\\b(new)\\s+([^\\s,\\{\\}\\(\\)\\[\\]]+)',
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/Scala.tmLanguage.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions tests/snap/lexical.test.scala.snap
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,21 @@
> ('a', '\u0041', '\n', '\t')
#^^^^ source.scala
# ^ source.scala meta.bracket.scala
# ^ source.scala constant.character.literal.scala punctuation.definition.character.begin.scala
# ^ source.scala constant.character.literal.scala
# ^ source.scala constant.character.literal.scala punctuation.definition.character.end.scala
# ^ source.scala string.quoted.other constant.character.literal.scala punctuation.definition.character.begin.scala
# ^ source.scala string.quoted.other constant.character.literal.scala
# ^ source.scala string.quoted.other constant.character.literal.scala punctuation.definition.character.end.scala
# ^^^^^ source.scala
# ^ source.scala constant.character.literal.scala punctuation.definition.character.begin.scala
# ^^^^^^ source.scala constant.character.literal.scala constant.character.escape.scala
# ^ source.scala constant.character.literal.scala punctuation.definition.character.end.scala
# ^ source.scala string.quoted.other constant.character.literal.scala punctuation.definition.character.begin.scala
# ^^^^^^ source.scala string.quoted.other constant.character.literal.scala constant.character.escape.scala
# ^ source.scala string.quoted.other constant.character.literal.scala punctuation.definition.character.end.scala
# ^^^^^ source.scala
# ^ source.scala constant.character.literal.scala punctuation.definition.character.begin.scala
# ^^ source.scala constant.character.literal.scala constant.character.escape.scala
# ^ source.scala constant.character.literal.scala punctuation.definition.character.end.scala
# ^ source.scala string.quoted.other constant.character.literal.scala punctuation.definition.character.begin.scala
# ^^ source.scala string.quoted.other constant.character.literal.scala constant.character.escape.scala
# ^ source.scala string.quoted.other constant.character.literal.scala punctuation.definition.character.end.scala
# ^^^^^ source.scala
# ^ source.scala constant.character.literal.scala punctuation.definition.character.begin.scala
# ^^ source.scala constant.character.literal.scala constant.character.escape.scala
# ^ source.scala constant.character.literal.scala punctuation.definition.character.end.scala
# ^ source.scala string.quoted.other constant.character.literal.scala punctuation.definition.character.begin.scala
# ^^ source.scala string.quoted.other constant.character.literal.scala constant.character.escape.scala
# ^ source.scala string.quoted.other constant.character.literal.scala punctuation.definition.character.end.scala
# ^ source.scala meta.bracket.scala
>}
#^ source.scala punctuation.section.block.end.scala
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/lexical.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,9 @@ object Xml {
<authors>{scalaBook.authors.mkList("", ", ", "")}</authors>
</book>
}

class Parens {
capture("layout(" ~ oneOrMore(CharPredicate.All -- ")" -- ')') ~ ")")
// ^ string.quoted.other constant.character.literal.scala
capture("layout(" ~ oneOrMore(CharPredicate.All -- ")" -- `)`) ~ ")")
}

0 comments on commit b3bbdf0

Please sign in to comment.