From bf6767bc81bf0501add8ee3e9d3112975ca2a1af Mon Sep 17 00:00:00 2001 From: everdrone Date: Thu, 29 Aug 2024 07:08:23 +0200 Subject: [PATCH] Improve Rust highlight queries (#16747) Release Notes: - Add `@variable.parameter` highlight scope ![parameters are colored pink](https://github.com/user-attachments/assets/68920017-b191-4779-9aa6-856831938480) - Add `@attribute` highlight scope ![attributes are colored yellow](https://github.com/user-attachments/assets/558d6ce0-5e4c-4ecb-893c-bc8f88d63829) - Add markdown injection inside `doc_comment`s ![markdown highlighting](https://github.com/user-attachments/assets/93ef4cf6-5ac1-46c6-80d0-82ca7bee0447) --- crates/languages/src/rust/highlights.scm | 5 +++++ crates/languages/src/rust/injections.scm | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/crates/languages/src/rust/highlights.scm b/crates/languages/src/rust/highlights.scm index 44fd61d871b06f95a1af9de2110c16ac698089f6..0c3aa7efc7a2a54343ec26d11ec197e8ed7a1830 100644 --- a/crates/languages/src/rust/highlights.scm +++ b/crates/languages/src/rust/highlights.scm @@ -184,3 +184,8 @@ ] @operator (lifetime) @lifetime + +(parameter (identifier) @variable.parameter) + +(attribute_item) @attribute +(inner_attribute_item) @attribute diff --git a/crates/languages/src/rust/injections.scm b/crates/languages/src/rust/injections.scm index 0ce91f228773fef6d0763db3604db51a471a5079..39042e92c6a3f24e22f5266b5f7ae28f78cdc266 100644 --- a/crates/languages/src/rust/injections.scm +++ b/crates/languages/src/rust/injections.scm @@ -5,3 +5,11 @@ (macro_rule (token_tree) @content (#set! "language" "rust")) + +(block_comment + (doc_comment) @content + (#set! "language" "markdown")) + +(line_comment + (doc_comment) @content + (#set! "language" "markdown"))