summaryrefslogtreecommitdiff
path: root/vendor/queries/rust/textobjects.scm
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 17:04:53 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commitdf4d11bb95bc7ea9554b55d2211c4704a2594f08 (patch)
tree0b3a41bac163f6dc1e5c403e0c7a5547c482ec60 /vendor/queries/rust/textobjects.scm
parent68e30f560e46bb9a30433eb23b4edb1b93d69f46 (diff)
downloadpardes-df4d11bb95bc7ea9554b55d2211c4704a2594f08.tar.gz
pardes-df4d11bb95bc7ea9554b55d2211c4704a2594f08.zip
]f, mif and the other textobject keys use helix's own queries
helix's textobjects.scm for pardes's grammars are vendored in vendor/queries under MPL-2.0, each with a header naming its source and what it inherits, inlined; a README says what is there and what is not. syntax.objectAt and objectNext run them over the file's kept parse, with their #eq? and #match? predicates, for ]f [f ]t [t ]a [a ]c [c ]T [T ]e [e ]x [x and mi/ma with f t a c T e x. erlang's and zig's queries do not compile against the grammar versions pardes builds and are left out; fortran, markdown and powershell have none in helix. A test replays sixteen Python and JSON cases whose results were taken from the installed hx, and another holds that every vendored query compiles. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'vendor/queries/rust/textobjects.scm')
-rw-r--r--vendor/queries/rust/textobjects.scm90
1 files changed, 90 insertions, 0 deletions
diff --git a/vendor/queries/rust/textobjects.scm b/vendor/queries/rust/textobjects.scm
new file mode 100644
index 00000000..d888c762
--- /dev/null
+++ b/vendor/queries/rust/textobjects.scm
@@ -0,0 +1,90 @@
+; Vendored from helix (https://github.com/helix-editor/helix) at 278b24389:
+; runtime/queries/rust/textobjects.scm.
+; Licensed under the Mozilla Public License 2.0 (vendor/queries/helix.LICENSE,
+; https://mozilla.org/MPL/2.0/).
+
+(function_item
+ body: (_) @function.inside) @function.around
+
+(closure_expression
+ body: (_) @function.inside) @function.around
+
+(struct_item
+ body: (_) @class.inside) @class.around
+
+(enum_item
+ body: (_) @class.inside) @class.around
+
+(union_item
+ body: (_) @class.inside) @class.around
+
+(trait_item
+ body: (_) @class.inside) @class.around
+
+(impl_item
+ body: (_) @class.inside) @class.around
+
+(parameters
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(type_parameters
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(type_arguments
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(closure_parameters
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(arguments
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(field_initializer_list
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+[
+ (line_comment)
+ (block_comment)
+] @comment.inside
+
+(line_comment)+ @comment.around
+
+(block_comment) @comment.around
+
+(; #[test]
+ (attribute_item
+ (attribute
+ (identifier) @_test_attribute))
+ ; allow other attributes like #[should_panic] and comments
+ [
+ (attribute_item)
+ (line_comment)
+ ]*
+ ; the test function
+ (function_item
+ body: (_) @test.inside) @test.around
+ (#eq? @_test_attribute "test"))
+
+(array_expression
+ (_) @entry.around)
+
+(tuple_expression
+ (_) @entry.around)
+
+(tuple_pattern
+ (_) @entry.around)
+
+; Commonly used vec macro initializer is special cased
+(macro_invocation
+ (identifier) @_id (token_tree (_) @entry.around)
+ (#eq? @_id "vec"))
+
+(enum_variant) @entry.around
+
+(field_declaration
+ (_) @entry.inside) @entry.around
+
+(field_initializer
+ (_) @entry.inside) @entry.around
+
+(shorthand_field_initializer) @entry.around