diff --git a/editors/code/package.json b/editors/code/package.json index b4620243c9fe..96d63b42393a 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -1562,6 +1562,16 @@ "language": "ra_syntax_tree", "scopeName": "source.ra_syntax_tree", "path": "ra_syntax_tree.tmGrammar.json" + }, + { + "scopeName": "rustdoc.markdown.injection", + "path": "rustdoc.markdown.injection.tmGrammar.json", + "injectTo": [ + "source.rust" + ], + "embeddedLanguages": { + "meta.embedded.block.markdown": "text.html.markdown" + } } ], "problemMatchers": [ diff --git a/editors/code/rustdoc.markdown.injection.tmGrammar.json b/editors/code/rustdoc.markdown.injection.tmGrammar.json new file mode 100644 index 000000000000..3ee49bff31ef --- /dev/null +++ b/editors/code/rustdoc.markdown.injection.tmGrammar.json @@ -0,0 +1,36 @@ +{ + "scopeName": "rustdoc.markdown.injection", + "injectionSelector": "L:source.rust", + "patterns": [ + { + "include": "#doc-comment-line" + }, + { + "include": "#doc-comment-block" + } + ], + "repository": { + "doc-comment-line": { + "name": "comment.line.documentation.rust", + "begin": "^\\s*//(/|!)", + "while": "^\\s*//(/|!)", + "contentName": "meta.embedded.block.markdown", + "patterns": [ + { + "include": "text.html.markdown" + } + ] + }, + "doc-comment-block": { + "name": "comment.block.documentation.rust", + "begin": "/\\*(\\*|!)", + "end": "\\s*\\*/", + "contentName": "meta.embedded.block.markdown", + "patterns": [ + { + "include": "text.html.markdown" + } + ] + } + } +}