diff --git a/vscode-insta/package.json b/vscode-insta/package.json index c37e27a2..50af0556 100644 --- a/vscode-insta/package.json +++ b/vscode-insta/package.json @@ -39,7 +39,17 @@ "language": "insta-snapshots", "scopeName": "source.insta-snapshots", "path": "./syntaxes/insta-snapshots.tmLanguage.json" + }, + { + "scopeName": "source.inline-insta-snapshots", + "injectTo": [ + "source.rust" + ], + "path": "./syntaxes/inline-insta-snapshots.tmLanguage.json", + "embeddedLanguages": { + "meta.embedded.inline-insta-snapshot": "insta-snapshots" + } } ] } -} +} \ No newline at end of file diff --git a/vscode-insta/syntaxes/inline-insta-snapshots.tmLanguage.json b/vscode-insta/syntaxes/inline-insta-snapshots.tmLanguage.json new file mode 100644 index 00000000..aaf4312e --- /dev/null +++ b/vscode-insta/syntaxes/inline-insta-snapshots.tmLanguage.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "injectionSelector": "L:source -string -comment", + "fileTypes": [ + "rust" + ], + "patterns": [ + { + "begin": "(@)(r###)(\")", + "contentName": "meta.embedded.inline-insta-snapshot", + "beginCaptures": { + "1": { + "name": "keyword.operator.subpattern.rust" + }, + "2": { + "name": "punctuation.definition.string.raw.rust" + }, + "3": { + "name": "punctuation.definition.string.rust" + } + }, + "end": "(\")(###)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.rust" + }, + "2": { + "name": "punctuation.definition.string.raw.rust" + } + }, + "patterns": [ + { + "include": "source.insta-snapshots#snapshot" + } + ] + } + ], + "scopeName": "source.inline-insta-snapshots" +} \ No newline at end of file