From ae3eac8aeb669581935cbe036de9993f44da512c Mon Sep 17 00:00:00 2001 From: Caleb Larsen Date: Sat, 31 May 2025 14:37:25 -0500 Subject: [PATCH] fix: Rust now correctly highlights doc comments as @comment.{block,line}.documentation instead of @comment --- runtime/queries/rust/highlights.scm | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 95aad6439..981896f94 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -106,12 +106,28 @@ (string_literal) (raw_string_literal) ] @string -(outer_doc_comment_marker "/" @comment) -(inner_doc_comment_marker "!" @comment) -[ - (line_comment) - (block_comment) -] @comment + +; ------- +; Comments +; ------- + +(line_comment) @comment.line +(block_comment) @comment.block + +; Doc Comments +(line_comment + (outer_doc_comment_marker "/" @comment.line.documentation) + (doc_comment)) @comment.line.documentation +(line_comment + (inner_doc_comment_marker "!" @comment.line.documentation) + (doc_comment)) @comment.line.documentation + +(block_comment + (outer_doc_comment_marker) @comment.block.documentation + (doc_comment) "*/" @comment.block.documentation) @comment.block.documentation +(block_comment + (inner_doc_comment_marker) @comment.block.documentation + (doc_comment) "*/" @comment.block.documentation) @comment.block.documentation ; --- ; Extraneous