Skip to content

Commit 1dba34a

Browse files
committed
Mark identifiers as variable by default.
This handles the case of labels whose location is not recoverable just from the AST: - function definitions `(~label as name)` - function calls `~label = 10` - component props `prop = 42`
1 parent 36d6747 commit 1dba34a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

grammars/rescript.tmLanguage.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@
206206
}
207207
]
208208
},
209+
"defaultIdIsVariable": {
210+
"patterns": [
211+
{
212+
"match": "[A-Za-z_][A-Za-z0-9]*",
213+
"name": "variable"
214+
}
215+
]
216+
},
209217
"number": {
210218
"patterns": [
211219
{
@@ -501,6 +509,9 @@
501509
},
502510
{
503511
"include": "#punctuations"
512+
},
513+
{
514+
"include": "#defaultIdIsVariable"
504515
}
505516
]
506517
}

0 commit comments

Comments
 (0)