diff --git a/CHANGELOG.md b/CHANGELOG.md index fac0814d9..fc9645b42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,9 @@ - Highlight tagged template literal functions as functions. https://github.com/rescript-lang/rescript-vscode/pull/920 - Complete for `type t` values when encountering a `type t` in relevant scenarios. https://github.com/rescript-lang/rescript-vscode/pull/924 - Highlight escaped sequences as a whole and not only the first character. https://github.com/rescript-lang/rescript-vscode/pull/929 -- Start highlighting escaped sequences in template literals. https://github.com/rescript-lang/rescript-vscode/pull/929 +- Highlight escaped sequences in template strings. https://github.com/rescript-lang/rescript-vscode/pull/929 +- Highlight trailing backslash for multi-line strings. https://github.com/rescript-lang/rescript-vscode/pull/929 +- Highlight comments, `int`, `float`, `bool`, and `char` values inside of embeded expressions in template strings. https://github.com/rescript-lang/rescript-vscode/pull/930 ## 1.38.0 diff --git a/grammars/rescript.tmLanguage.json b/grammars/rescript.tmLanguage.json index 5990a9476..cb8001fec 100644 --- a/grammars/rescript.tmLanguage.json +++ b/grammars/rescript.tmLanguage.json @@ -119,84 +119,87 @@ } ] }, + "expression": { + "patterns": [ + { "include": "#constant" }, + { "include": "#bracketAccess" }, + { "include": "#string" }, + { "include": "#number" }, + { "include": "#character" } + ] + }, "string-character-escape": { "name": "constant.character.escape", "match": "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u{[0-9A-Fa-f]+}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)" }, - "string": { + "string-double-quoted": { + "name": "string.quoted.double", + "begin": "\"", + "end": "\"", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end" + } + }, "patterns": [ { - "name": "string.quoted.double", - "begin": "\"", - "end": "\"", - "beginCaptures": { - "1": { - "name": "punctuation.definition.string.begin" - } - }, - "endCaptures": { - "1": { - "name": "punctuation.definition.string.end" - } - }, - "patterns": [ - { - "include": "#string-character-escape" - } - ] + "include": "#string-character-escape" + } + ] + }, + "template": { + "name": "string.template", + "begin": "([a-z_][0-9a-zA-Z_]*)?(`)", + "end": "(?