Skip to content

Commit 3d1591d

Browse files
Add syntax highlighting for raw JS code (#774)
* Add syntax highlighting for raw JS code * changelog * Sort patterns in tmLanguage.json
1 parent 1245005 commit 3d1591d

File tree

2 files changed

+52
-19
lines changed

2 files changed

+52
-19
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
1313
## master
1414

15+
#### :rocket: New Feature
16+
17+
- Add support for syntax highlighting in `%raw` and `%ffi` extension points. https://github.com/rescript-lang/rescript-vscode/pull/774
18+
1519
## 1.18.0
1620

1721
#### :rocket: New Feature

grammars/rescript.tmLanguage.json

+48-19
Original file line numberDiff line numberDiff line change
@@ -481,71 +481,100 @@
481481
]
482482
}
483483
]
484+
},
485+
"ffi": {
486+
"name": "source.embedded.javascript",
487+
"begin": "(%|%%)(raw|ffi)(\\()(`)",
488+
"end": "(`)(\\))",
489+
"beginCaptures": {
490+
"1": {
491+
"name": "punctuation.decorator"
492+
},
493+
"2": {
494+
"name": "entity.name.function"
495+
},
496+
"4": {
497+
"name": "punctuation.definition.string.template.begin.embedded-js"
498+
}
499+
},
500+
"endCaptures": {
501+
"1": {
502+
"name": "punctuation.definition.string.template.end.embedded-js"
503+
}
504+
},
505+
"patterns": [
506+
{
507+
"include": "source.js"
508+
}
509+
]
484510
}
485511
},
486512
"patterns": [
487513
{
488-
"include": "#storage"
514+
"include": "#attribute"
489515
},
490516
{
491-
"include": "#constant"
517+
"include": "#bracketAccess"
492518
},
493519
{
494-
"include": "#commentLine"
520+
"include": "#character"
495521
},
496522
{
497523
"include": "#commentBlock"
498524
},
499525
{
500-
"include": "#character"
501-
},
502-
{
503-
"include": "#typeParameter"
526+
"include": "#commentLine"
504527
},
505528
{
506-
"include": "#string"
529+
"include": "#constant"
507530
},
508531
{
509-
"include": "#attribute"
532+
"include": "#constructor"
510533
},
511534
{
512-
"include": "#function"
535+
"include": "#defaultIdIsVariable"
513536
},
514537
{
515-
"include": "#list"
538+
"include": "#ffi"
516539
},
517540
{
518-
"include": "#bracketAccess"
541+
"include": "#function"
519542
},
520543
{
521544
"include": "#jsx"
522545
},
523546
{
524-
"include": "#operator"
547+
"include": "#keyword"
525548
},
526549
{
527-
"include": "#number"
550+
"include": "#list"
528551
},
529552
{
530-
"include": "#openOrIncludeModule"
553+
"include": "#moduleAccess"
531554
},
532555
{
533556
"include": "#moduleDeclaration"
534557
},
535558
{
536-
"include": "#moduleAccess"
559+
"include": "#number"
537560
},
538561
{
539-
"include": "#constructor"
562+
"include": "#openOrIncludeModule"
540563
},
541564
{
542-
"include": "#keyword"
565+
"include": "#operator"
543566
},
544567
{
545568
"include": "#punctuations"
546569
},
547570
{
548-
"include": "#defaultIdIsVariable"
571+
"include": "#storage"
572+
},
573+
{
574+
"include": "#string"
575+
},
576+
{
577+
"include": "#typeParameter"
549578
}
550579
]
551580
}

0 commit comments

Comments
 (0)