From 1a9af10ca257c812a987d137fb63278541a48580 Mon Sep 17 00:00:00 2001 From: earomc <36933273+earomc@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:53:17 +0200 Subject: [PATCH] rust: Add highlight selector for doc comments (#15384) ## Release Notes: - Added ability to style doc comments in Rust separately with `comment.doc` ([#15322](https://github.com/zed-industries/zed/issues/15322)). Just required adding another query to the highlights.scm file. Took inspiration from the tree-sitter-rust repository [here](https://github.com/tree-sitter/tree-sitter-rust/blob/master/queries/highlights.scm) #### Doc comments customized in the theme are working now: ![grafik](https://github.com/user-attachments/assets/549f20d6-534c-4c3b-a317-3be6bc44352e) #### Snippet from the .json theme file ![grafik](https://github.com/user-attachments/assets/da1d7e3d-b6a5-4ba5-9fef-047d69f9ea03) --- crates/languages/src/rust/highlights.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/languages/src/rust/highlights.scm b/crates/languages/src/rust/highlights.scm index b98812fe3914a2574649fce59c0bfef3a58035af..44fd61d871b06f95a1af9de2110c16ac698089f6 100644 --- a/crates/languages/src/rust/highlights.scm +++ b/crates/languages/src/rust/highlights.scm @@ -133,6 +133,11 @@ (block_comment) ] @comment +[ + (line_comment (doc_comment)) + (block_comment (doc_comment)) +] @comment.doc + [ "!" "!="