Highlight Rust doc comments with markdown

The test changes are needed because of the changes to comment parsing.
The `1..36` to `1..37` change is because line comments now consume the
newline.
This commit is contained in:
Michael Davis 2024-02-17 09:19:24 -05:00
parent 98ebeeebd8
commit ec27d0707a
No known key found for this signature in database
4 changed files with 11 additions and 7 deletions

View File

@ -2687,10 +2687,10 @@ fn test_textobject_queries() {
) )
}; };
test("quantified_nodes", 1..36); test("quantified_nodes", 1..37);
// NOTE: Enable after implementing proper node group capturing // NOTE: Enable after implementing proper node group capturing
// test("quantified_nodes_grouped", 1..36); // test("quantified_nodes_grouped", 1..37);
// test("multiple_nodes_grouped", 1..36); // test("multiple_nodes_grouped", 1..37);
} }
#[test] #[test]
@ -2861,7 +2861,7 @@ fn assert_pretty_print(
#[test] #[test]
fn test_pretty_print() { fn test_pretty_print() {
let source = r#"/// Hello"#; let source = r#"// Hello"#;
assert_pretty_print("rust", source, "(line_comment)", 0, source.len()); assert_pretty_print("rust", source, "(line_comment)", 0, source.len());
// A large tree should be indented with fields: // A large tree should be indented with fields:

View File

@ -234,7 +234,7 @@ args = { attachCommands = [ "platform select remote-gdb-server", "platform conne
[[grammar]] [[grammar]]
name = "rust" name = "rust"
source = { git = "https://github.com/tree-sitter/tree-sitter-rust", rev = "0431a2c60828731f27491ee9fdefe25e250ce9c9" } source = { git = "https://github.com/tree-sitter/tree-sitter-rust", rev = "35f4a5b8a29c161402e89dba83dcdc9876ba1dac" }
[[language]] [[language]]
name = "sway" name = "sway"

View File

@ -51,7 +51,7 @@
(lifetime (lifetime
"'" @label "'" @label
(identifier) @label) (identifier) @label)
(loop_label (label
"'" @label "'" @label
(identifier) @label) (identifier) @label)

View File

@ -1,6 +1,10 @@
([(line_comment) (block_comment)] @injection.content ([(line_comment !doc) (block_comment !doc)] @injection.content
(#set! injection.language "comment")) (#set! injection.language "comment"))
((doc_comment) @injection.content
(#set! injection.language "markdown")
(#set! injection.combined))
((macro_invocation ((macro_invocation
macro: macro:
[ [