about summary refs log tree commit diff
path: root/editors/code/rustdoc-inject.json
diff options
context:
space:
mode:
authorYouWei Zhao <zhao.uv@gmail.com>2024-01-10 21:55:41 +0800
committerYouWei Zhao <zhao.uv@gmail.com>2024-01-10 21:55:41 +0800
commit0380d982f9cf6cd49de3ea009f37bdc18e30e81f (patch)
tree3e6afbf36e7da433d70cc1458b349b20c6d8fdf9 /editors/code/rustdoc-inject.json
parent1c9bb3197048a63fefaa53866764d296dc3bd7c2 (diff)
highlight rustdoc
Diffstat (limited to 'editors/code/rustdoc-inject.json')
-rw-r--r--editors/code/rustdoc-inject.json93
1 files changed, 93 insertions, 0 deletions
diff --git a/editors/code/rustdoc-inject.json b/editors/code/rustdoc-inject.json
new file mode 100644
index 00000000000..45ca2fa96bc
--- /dev/null
+++ b/editors/code/rustdoc-inject.json
@@ -0,0 +1,93 @@
+{
+    "injectionSelector": "L:source.rust -string -comment -meta.embedded.block.rustdoc.md",
+    "patterns": [
+        {
+            "include": "#triple-slash"
+        },
+        {
+            "include": "#double-slash-exclamation"
+        },
+        {
+            "include": "#slash-start-exclamation"
+        },
+        {
+            "include": "#slash-double-start"
+        }
+    ],
+    "repository": {
+        "triple-slash": {
+            "begin": "(^|\\G)\\s*(///) ?",
+            "captures": {
+                "2": {
+                    "name": "comment.line.double-slash.rust"
+                }
+            },
+            "name": "comment.quote_code.triple-slash.rust",
+            "contentName": "meta.embedded.block.rustdoc",
+            "patterns": [
+                {
+                    "include": "text.html.markdown.rustdoc"
+                }
+            ],
+            "while": "(^|\\G)\\s*(///) ?"
+        },
+        "double-slash-exclamation": {
+            "begin": "(^|\\G)\\s*(//!) ?",
+            "captures": {
+                "2": {
+                    "name": "comment.line.double-slash.rust"
+                }
+            },
+            "name": "comment.quote_code.double-slash-exclamation.rust",
+            "contentName": "meta.embedded.block.rustdoc",
+            "patterns": [
+                {
+                    "include": "text.html.markdown.rustdoc"
+                }
+            ],
+            "while": "(^|\\G)\\s*(//!) ?"
+        },
+        "slash-start-exclamation": {
+            "begin": "(^)(/\\*!) ?$",
+            "captures": {
+                "2": {
+                    "name": "comment.block.rust"
+                }
+            },
+            "name": "comment.quote_code.slash-start-exclamation.rust",
+            "contentName": "meta.embedded.block.rustdoc",
+            "patterns": [
+                {
+                    "include": "text.html.markdown.rustdoc"
+                }
+            ],
+            "end": "( ?)(\\*/)"
+        },
+        "slash-double-start": {
+            "name": "comment.quote_code.slash-double-start-quote-star.rust",
+            "begin": "(?:^)\\s*/\\*\\* ?$",
+            "end": "\\*/",
+            "patterns": [
+                {
+                    "include": "#quote-star"
+                }
+            ]
+        },
+        "quote-star": {
+            "begin": "(^|\\G)\\s*(\\*(?!/)) ?",
+            "captures": {
+                "2": {
+                    "name": "comment.punctuation.definition.quote_code.slash-star.MR"
+                }
+            },
+            "contentName": "meta.embedded.block.rustdoc",
+            "patterns": [
+                {
+                    "include": "text.html.markdown.rustdoc"
+                }
+            ],
+            "while": "(^|\\G)\\s*(\\*(?!/)) ?"
+        }
+    },
+    "scopeName": "comment.markdown-cell-inject.rustdoc"
+}
\ No newline at end of file