diff --git a/CHANGELOG.md b/CHANGELOG.md index 356711757..376172964 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ ## master +#### :rocket: New Feature + +- Add support for syntax highlighting in `%raw` and `%ffi` extension points. https://github.com/rescript-lang/rescript-vscode/pull/774 + ## 1.18.0 #### :rocket: New Feature diff --git a/grammars/rescript.tmLanguage.json b/grammars/rescript.tmLanguage.json index db63e9b56..4acab2243 100644 --- a/grammars/rescript.tmLanguage.json +++ b/grammars/rescript.tmLanguage.json @@ -481,71 +481,100 @@ ] } ] + }, + "ffi": { + "name": "source.embedded.javascript", + "begin": "(%|%%)(raw|ffi)(\\()(`)", + "end": "(`)(\\))", + "beginCaptures": { + "1": { + "name": "punctuation.decorator" + }, + "2": { + "name": "entity.name.function" + }, + "4": { + "name": "punctuation.definition.string.template.begin.embedded-js" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.template.end.embedded-js" + } + }, + "patterns": [ + { + "include": "source.js" + } + ] } }, "patterns": [ { - "include": "#storage" + "include": "#attribute" }, { - "include": "#constant" + "include": "#bracketAccess" }, { - "include": "#commentLine" + "include": "#character" }, { "include": "#commentBlock" }, { - "include": "#character" - }, - { - "include": "#typeParameter" + "include": "#commentLine" }, { - "include": "#string" + "include": "#constant" }, { - "include": "#attribute" + "include": "#constructor" }, { - "include": "#function" + "include": "#defaultIdIsVariable" }, { - "include": "#list" + "include": "#ffi" }, { - "include": "#bracketAccess" + "include": "#function" }, { "include": "#jsx" }, { - "include": "#operator" + "include": "#keyword" }, { - "include": "#number" + "include": "#list" }, { - "include": "#openOrIncludeModule" + "include": "#moduleAccess" }, { "include": "#moduleDeclaration" }, { - "include": "#moduleAccess" + "include": "#number" }, { - "include": "#constructor" + "include": "#openOrIncludeModule" }, { - "include": "#keyword" + "include": "#operator" }, { "include": "#punctuations" }, { - "include": "#defaultIdIsVariable" + "include": "#storage" + }, + { + "include": "#string" + }, + { + "include": "#typeParameter" } ] } \ No newline at end of file