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

ozacod created

Before:
<img width="557" height="668" alt="before"
src="https://github.com/user-attachments/assets/5accf661-94cd-4933-8771-98f813199c39"
/>

After:
<img width="581" height="668" alt="after"
src="https://github.com/user-attachments/assets/251101ca-6e12-4dc3-b4dd-41b2438f9bd7"
/>

Release Notes:

- Added highlighting for document comments in C/C++

Change summary

crates/languages/src/c/injections.scm   | 5 +++++
crates/languages/src/cpp/injections.scm | 5 +++++
2 files changed, 10 insertions(+)

Detailed changes

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"))

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++"))