From 378bb8c8764e54cb83d4c6debda9d71340c2bc35 Mon Sep 17 00:00:00 2001 From: eh Date: Thu, 20 Feb 2025 09:47:14 -0500 Subject: [PATCH] Rust symbol queries (#12859) --- book/src/generated/lang-support.md | 2 +- runtime/queries/rust/symbols.scm | 33 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/rust/symbols.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 102f4dc4a..2338c28e5 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -182,7 +182,7 @@ | ron | ✓ | | ✓ | | | | rst | ✓ | | | | | | ruby | ✓ | ✓ | ✓ | | `solargraph` | -| rust | ✓ | ✓ | ✓ | | `rust-analyzer` | +| rust | ✓ | ✓ | ✓ | ✓ | `rust-analyzer` | | sage | ✓ | ✓ | | | | | scala | ✓ | ✓ | ✓ | | `metals` | | scheme | ✓ | | ✓ | | | diff --git a/runtime/queries/rust/symbols.scm b/runtime/queries/rust/symbols.scm new file mode 100644 index 000000000..8d0dae31e --- /dev/null +++ b/runtime/queries/rust/symbols.scm @@ -0,0 +1,33 @@ +(struct_item + name: (type_identifier) @definition.struct + body: (field_declaration_list)) + +(const_item + name: (identifier) @definition.constant) + +(trait_item + name: (type_identifier) @definition.interface + body: (declaration_list)) + +(function_item + name: (identifier) @definition.function + parameters: (parameters) + body: (block)) + +(function_signature_item + name: (identifier) @definition.function + parameters: (parameters)) + +(enum_item + name: (type_identifier) @definition.type + body: (enum_variant_list)) + +(enum_variant + name: (identifier) @definition.struct) + +(mod_item + name: (identifier) @definition.module + body: (declaration_list)) + +(macro_definition + macro: (identifier) @definition.macro)