From 2058b3732c340f5bc29eee2aca1d8edae15e1314 Mon Sep 17 00:00:00 2001 From: melted-brownie <66597133+melted-brownie@users.noreply.github.com> Date: Tue, 23 Jan 2024 17:27:09 +0000 Subject: [PATCH] Add text object queries for dart (#9411) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add text object queries for dart * Update runtime/queries/dart/textobjects.scm Co-authored-by: Michael Davis * Clean up internal capture name --------- Co-authored-by: Sébastien Blondiau Co-authored-by: Michael Davis --- book/src/generated/lang-support.md | 2 +- runtime/queries/dart/textobjects.scm | 68 ++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/dart/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 6fedace63..a78dd7935 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -24,7 +24,7 @@ | css | ✓ | | ✓ | `vscode-css-language-server` | | cue | ✓ | | | `cuelsp` | | d | ✓ | ✓ | ✓ | `serve-d` | -| dart | ✓ | | ✓ | `dart` | +| dart | ✓ | ✓ | ✓ | `dart` | | dbml | ✓ | | | | | devicetree | ✓ | | | | | dhall | ✓ | ✓ | | `dhall-lsp-server` | diff --git a/runtime/queries/dart/textobjects.scm b/runtime/queries/dart/textobjects.scm new file mode 100644 index 000000000..028276156 --- /dev/null +++ b/runtime/queries/dart/textobjects.scm @@ -0,0 +1,68 @@ +(class_definition + body: (_) @class.inside) @class.around + +(mixin_declaration + (class_body) @class.inside) @class.around + +(extension_declaration + (extension_body) @class.inside) @class.around + +(enum_declaration + body: (_) @class.inside) @class.around + +(type_alias) @class.around + +(_ + ( + [ + (getter_signature) + (setter_signature) + (function_signature) + (method_signature) + (constructor_signature) + ] + . + (function_body) @function.inside @function.around + ) @function.around +) + +(declaration + [ + (constant_constructor_signature) + (constructor_signature) + (factory_constructor_signature) + (redirecting_factory_constructor_signature) + (getter_signature) + (setter_signature) + (operator_signature) + (function_signature) + ] +) @function.around + +(lambda_expression + body: (_) @function.inside +) @function.around + +(function_expression + body: (_) @function.inside +) @function.around + +[ + (comment) + (documentation_comment) +] @comment.inside + +(comment)+ @comment.around + +(documentation_comment)+ @comment.around + +(formal_parameter) @parameter.inside + +(formal_parameter_list) @parameter.around + +(expression_statement + ((identifier) @_name (#any-of? @_name "test" "testWidgets")) + . + (selector (argument_part (arguments . (_) . (argument) @test.inside))) +) @test.around +