diff --git a/CHANGELOG.md b/CHANGELOG.md index a0cba02a1..0b5aa429d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - Fix invalid range for `definition`. https://github.com/rescript-lang/rescript-vscode/pull/781 - Don't emit object keys in uppercase as namespace. https://github.com/rescript-lang/rescript-vscode/pull/798 - Fix accidental output of extra `|` when producing exhaustive switch code for polyvariants. https://github.com/rescript-lang/rescript-vscode/pull/805 +- Fix JS syntax highlighting in single-line FFI extension points. https://github.com/rescript-lang/rescript-vscode/pull/807 ## 1.18.0 diff --git a/grammars/rescript.tmLanguage.json b/grammars/rescript.tmLanguage.json index 40859eb24..085e3ef5d 100644 --- a/grammars/rescript.tmLanguage.json +++ b/grammars/rescript.tmLanguage.json @@ -508,12 +508,40 @@ "include": "source.js" } ] + }, + "ffi-single": { + "name": "source.embedded.javascript.single", + "match": "(%|%%)(raw|ffi)(\\()(`)(.*?)(`)(\\))", + "captures": { + "1": { + "name": "punctuation.decorator" + }, + "2": { + "name": "entity.name.function" + }, + "4": { + "name": "punctuation.definition.string.template.begin.embedded-js" + }, + "5": { + "patterns": [ + { + "include": "source.js" + } + ] + }, + "6": { + "name": "punctuation.definition.string.template.end.embedded-js" + } + } } }, "patterns": [ { "include": "#storage" }, + { + "include": "#ffi-single" + }, { "include": "#ffi" },