From 10463fe32c789f49c65d53c9d22621e415a854ea Mon Sep 17 00:00:00 2001 From: Andrey Tkachenko Date: Mon, 23 May 2022 16:24:30 +0400 Subject: [PATCH] Add `parameter.around` text object query --- runtime/queries/c/textobjects.scm | 6 +++++- runtime/queries/go/textobjects.scm | 7 +++++-- runtime/queries/php/textobjects.scm | 12 +++++++++--- runtime/queries/python/textobjects.scm | 6 +++--- runtime/queries/rust/textobjects.scm | 15 +++++++++------ 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/runtime/queries/c/textobjects.scm b/runtime/queries/c/textobjects.scm index 45f554e28..2a3da66f3 100644 --- a/runtime/queries/c/textobjects.scm +++ b/runtime/queries/c/textobjects.scm @@ -10,7 +10,11 @@ (union_specifier body: (_) @class.inside) @class.around -(parameter_declaration) @parameter.inside +(parameter_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(argument_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) (comment) @comment.inside diff --git a/runtime/queries/go/textobjects.scm b/runtime/queries/go/textobjects.scm index 3cdf62037..a48ccce18 100644 --- a/runtime/queries/go/textobjects.scm +++ b/runtime/queries/go/textobjects.scm @@ -14,11 +14,14 @@ (type_declaration (type_spec (type_identifier) (interface_type (method_spec)+ @class.inside))) @class.around +(type_parameter_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + (parameter_list - (_) @parameter.inside) + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) (argument_list - (_) @parameter.inside) + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) (comment) @comment.inside diff --git a/runtime/queries/php/textobjects.scm b/runtime/queries/php/textobjects.scm index 51abe5c7d..e35eebd76 100644 --- a/runtime/queries/php/textobjects.scm +++ b/runtime/queries/php/textobjects.scm @@ -21,13 +21,19 @@ (anonymous_function_creation_expression body: (_) @function.inside) @function.around - + +(anonymous_function_use_clause + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + (formal_parameters - [ + ([ (simple_parameter) (variadic_parameter) (property_promotion_parameter) - ] @parameter.inside) + ] @parameter.inside . ","? @parameter.around) @parameter.around) + +(arguments + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) (comment) @comment.inside diff --git a/runtime/queries/python/textobjects.scm b/runtime/queries/python/textobjects.scm index 0ca260890..5c6a61d17 100644 --- a/runtime/queries/python/textobjects.scm +++ b/runtime/queries/python/textobjects.scm @@ -5,13 +5,13 @@ body: (block)? @class.inside) @class.around (parameters - (_) @parameter.inside) + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) (lambda_parameters - (_) @parameter.inside) + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) (argument_list - (_) @parameter.inside) + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) (comment) @comment.inside diff --git a/runtime/queries/rust/textobjects.scm b/runtime/queries/rust/textobjects.scm index 99b5eb4d9..b2769c139 100644 --- a/runtime/queries/rust/textobjects.scm +++ b/runtime/queries/rust/textobjects.scm @@ -52,17 +52,20 @@ (impl_item body: (_) @class.inside)) @class.around -(parameters - (_) @parameter.inside) - +(parameters + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + (type_parameters - (_) @parameter.inside) + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(type_arguments + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) (closure_parameters - (_) @parameter.inside) + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) (arguments - (_) @parameter.inside) + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) [ (line_comment)