Skip to content

Commit 1bf87b3

Browse files
authored
Require whitespace before as in to/downto labels (#1085)
* Require whitespace before `as` in `to`/`downto` labels The `RE_TO_DOWNTO_AS_LABELS` rule previously used `\s*` between `(to|downto)` and `(as)`, allowing zero spaces and accidentally matching identifiers like "toast". Change the pattern to `\s+` so that an actual space is required, preventing spurious `as` highlighting inside identifiers. * Prefix `RE_TO_DOWNTO_AS_LABELS` patterns with `~` to ensure they only apply to labelled arguments * Add CHANGELOG entry
1 parent acd6d7d commit 1bf87b3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#### :bug: Bug fix
1616

17+
- Fix: incorrect highlighting of `as` inside labelled arguments like `toast` https://github.com/rescript-lang/rescript-vscode/pull/1085
18+
1719
- Fix: bug where incremental analysis does not work when the project folder contains a dot. https://github.com/rescript-lang/rescript-vscode/pull/1080
1820

1921
- Fix: bug where incremental compilation crashes when rewatch is being run in a specific package vs the root of the monorepo. https://github.com/rescript-lang/rescript-vscode/pull/1082

grammars/rescript.tmLanguage.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"RE_TO_DOWNTO_AS_LABELS": {
1111
"patterns": [
1212
{
13-
"match": "(to|downto)\\s*(=)",
13+
"match": "~(to|downto)\\s*(=)",
1414
"captures": {
1515
"1": {
1616
"name": "variable"
@@ -21,7 +21,7 @@
2121
}
2222
},
2323
{
24-
"match": "(to|downto)\\s*(as)",
24+
"match": "~(to|downto)\\s+(as)",
2525
"captures": {
2626
"1": {
2727
"name": "variable"

0 commit comments

Comments
 (0)