Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

languages: Add highlighting for document comments in C/C++ (#47556)

ozacode2f54a12727d
diff --git a/crates/languages/src/c/injections.scm b/crates/languages/src/c/injections.scm
index 447897340cc..9ec3cf1f780 100644
--- a/crates/languages/src/c/injections.scm
+++ b/crates/languages/src/c/injections.scm
@@ -2,6 +2,11 @@
(#set! injection.language "comment")
)
+((comment) @injection.content
+ (#match? @injection.content "^(///|//!|/\\*\\*|/\\*!)(.*)")
+ (#set! injection.language "doxygen")
+ (#set! injection.include-children))
+
(preproc_def
value: (preproc_arg) @injection.content
(#set! injection.language "c"))
diff --git a/crates/languages/src/cpp/injections.scm b/crates/languages/src/cpp/injections.scm
index 160770f3cc1..60c6ea7b63e 100644
--- a/crates/languages/src/cpp/injections.scm
+++ b/crates/languages/src/cpp/injections.scm
@@ -2,6 +2,11 @@
(#set! injection.language "comment")
)
+((comment) @injection.content
+ (#match? @injection.content "^(///|//!|/\\*\\*|/\\*!)(.*)")
+ (#set! injection.language "doxygen")
+ (#set! injection.include-children))
+
(preproc_def
value: (preproc_arg) @injection.content
(#set! injection.language "c++"))