Skip to content

Improve syntax highligting for escaped characters #929

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 3 commits into from
Feb 27, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
- Handle completion for DOM/element attributes and attribute values properly when using a generic JSX transform. https://github.com/rescript-lang/rescript-vscode/pull/919
- 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

## 1.38.0

Expand Down
12 changes: 9 additions & 3 deletions grammars/rescript.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@
}
]
},
"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": {
"patterns": [
{
Expand All @@ -137,8 +141,7 @@
},
"patterns": [
{
"name": "constant.character.escape",
"match": "\\\\."
"include": "#string-character-escape"
}
]
},
Expand All @@ -160,6 +163,9 @@
}
},
"patterns": [
{
"include": "#string-character-escape"
},
{
"name": "meta.template.expression",
"begin": "\\$\\{",
Expand Down Expand Up @@ -606,4 +612,4 @@
"include": "#defaultIdIsVariable"
}
]
}
}