diff --git a/queries/astro/textobjects.scm b/queries/astro/textobjects.scm new file mode 100644 index 0000000..718c4db --- /dev/null +++ b/queries/astro/textobjects.scm @@ -0,0 +1,2 @@ +; inherits: html + diff --git a/queries/bash/textobjects.scm b/queries/bash/textobjects.scm index 2404ce3..8933c55 100644 --- a/queries/bash/textobjects.scm +++ b/queries/bash/textobjects.scm @@ -25,3 +25,6 @@ (variable_assignment name: (_) @assignment.inner @assignment.lhs) (variable_assignment value: (_) @assignment.inner @assignment.rhs) +(command + argument: (word) @parameter.inner) + diff --git a/queries/c/textobjects.scm b/queries/c/textobjects.scm index 4c5345e..231f0cf 100644 --- a/queries/c/textobjects.scm +++ b/queries/c/textobjects.scm @@ -19,23 +19,32 @@ (enum_specifier body: (_) @class.inner) @class.outer -; conditional +; conditionals (if_statement - consequence: (_)? @conditional.inner - alternative: (_)? @conditional.inner - ) @conditional.outer + consequence: (compound_statement . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}" + )) @conditional.outer (if_statement - condition: (_) @conditional.inner) + alternative: (else_clause (compound_statement . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}" + ))) @conditional.outer + +(if_statement) @conditional.outer ; loops -(for_statement - (_)? @loop.inner) @loop.outer +(while_statement) @loop.outer (while_statement - (_)? @loop.inner) @loop.outer -(do_statement - (_)? @loop.inner) @loop.outer + body: (compound_statement . "{" . (_) @loop.inner._start @loop.inner._end (_)? @loop.inner._end . "}" + )) @loop.outer +(for_statement) @loop.outer +(for_statement + body: (compound_statement . "{" . (_) @loop.inner._start @loop.inner._end (_)? @loop.inner._end . "}" + )) @loop.outer + +(do_statement) @loop.outer +(do_statement + body: (compound_statement . "{" . (_) @loop.inner._start @loop.inner._end (_)? @loop.inner._end . "}" + )) @loop.outer (compound_statement) @block.outer (comment) @comment.outer diff --git a/queries/c_sharp/textobjects.scm b/queries/c_sharp/textobjects.scm index 6a50c08..5ecb462 100644 --- a/queries/c_sharp/textobjects.scm +++ b/queries/c_sharp/textobjects.scm @@ -10,6 +10,10 @@ body: (block . "{" . (_) @function.inner._start @function.inner._end (_)? @function.inner._end . "}" )) @function.outer +(method_declaration + body: (arrow_expression_clause . (_) @function.inner._start @function.inner._end (_)? @function.inner._end + )) @function.outer + (constructor_declaration body: (block . "{" . (_) @function.inner._start @function.inner._end (_)? @function.inner._end . "}" )) @function.outer diff --git a/queries/cpp/textobjects.scm b/queries/cpp/textobjects.scm index abdda50..dfef29f 100644 --- a/queries/cpp/textobjects.scm +++ b/queries/cpp/textobjects.scm @@ -6,8 +6,10 @@ type: (enum_specifier) default_value: (initializer_list) @class.inner) @class.outer -(for_range_loop - (_)? @loop.inner) @loop.outer +(for_range_loop)@loop.outer +(for_range_loop + body: (compound_statement . "{" . (_) @loop.inner._start @loop.inner._end (_)? @loop.inner._end . "}" + )) (template_declaration (function_definition) @function.outer) @function.outer.start diff --git a/queries/ecma/textobjects.scm b/queries/ecma/textobjects.scm index 3fbdcfd..701b652 100644 --- a/queries/ecma/textobjects.scm +++ b/queries/ecma/textobjects.scm @@ -1,14 +1,14 @@ (function_declaration body: (statement_block)) @function.outer -(function +(function_expression body: (statement_block)) @function.outer (function_declaration body: (statement_block . "{" . (_) @function.inner._start @function.inner._end (_)? @function.inner._end . "}" )) -(function +(function_expression body: (statement_block . "{" . (_) @function.inner._start @function.inner._end (_)? @function.inner._end . "}" )) @@ -55,6 +55,12 @@ consequence: (statement_block . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}" )) @conditional.outer +(if_statement + alternative: (else_clause (statement_block . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}" + ))) @conditional.outer + +(if_statement) @conditional.outer + (switch_statement body: (_)? @conditional.inner) @conditional.outer @@ -63,6 +69,12 @@ arguments: (arguments . "(" . (_) @call.inner._start (_)? @call.inner._end . ")" )) +((new_expression + constructor: (identifier) @_cons + arguments: (arguments . "(" . (_) @call.inner._start (_)? @call.inner._end . ")") @_args) + + ) + ;; blocks (_ (statement_block) @block.inner) @block.outer @@ -120,3 +132,8 @@ (variable_declarator name: (_) @assignment.inner) +(object + (pair + key: (_) @assignment.lhs + value: (_) @assignment.inner @assignment.rhs) @assignment.outer) + diff --git a/queries/fennel/textobjects.scm b/queries/fennel/textobjects.scm index d86a0ce..feb5a05 100644 --- a/queries/fennel/textobjects.scm +++ b/queries/fennel/textobjects.scm @@ -1,53 +1,35 @@ - ; https://fennel-lang.org/reference (comment) @comment.outer (_ . "(" ")" .) @statement.outer -; functions -((fn . name: (_)? . (parameters) . docstring: (_)? . (_) @function.inner._start . (_)* . (_)? @function.inner._end .) - ) @function.outer - -((lambda . name: (_)? . (parameters) . docstring: (_)? . (_) @function.inner._start . (_)* . (_)? @function.inner._end .) - ) @function.outer - -(hashfn ["#" "hashfn"] @function.outer.start (_) @function.inner) @function.outer - -; parameters -(parameters (_) @parameter.inner) -(parameters (_) @parameter.outer) +; functions & parameters +(list . + (symbol) @_fn + (symbol)? @_fn_name + (sequence + (_) @parameter.inner) + (_)* @function.inner + (#any-of? @_fn "fn" "lambda" "λ")) @function.outer ; call -((list . [(multi_symbol) (symbol)] @_sym . (_) @call.inner._start . (_)* . (_)? @call.inner._end .) - - (#not-any-of? @_sym "if" "do" "while" "for" "let" "when")) @call.outer +(list . + (symbol) @_fn_name + (_)* @call.inner + (#not-any-of? @_fn_name "if" "do" "while" "for" "each" "let" "when" "fn")) @call.outer ; conditionals -((list . ((symbol) @_if (#any-of? @_if "if" "when")) . (_) . - (_) @conditional.inner._start . - (_)* . - (_)? @conditional.inner._end .) - ) @conditional.outer - +(list + (symbol) @_cond + (_) + (_)* @conditional.inner + (#any-of? @_cond "if" "when")) @conditional.outer ; loops -((for . (for_clause) . - (_) @loop.inner._start . - (_)* . - (_)? @loop.inner._end .) - ) @loop.outer - -((each . (_) . - (_) @loop.inner._start . - (_)* . - (_)? @loop.inner._end .) - ) @loop.outer - -((list . ((symbol) @_while (#eq? @_while "while")) . (_) . - (_) @loop.inner._start . - (_)* . - (_)? @loop.inner._end .) - ) @loop.outer - +(list . + (symbol) @_sym . + (_) . + (_)* @loop.inner + (#any-of? @_sym "each" "while" "for")) @loop.outer diff --git a/queries/fish/textobjects.scm b/queries/fish/textobjects.scm index 525ae35..40c59be 100644 --- a/queries/fish/textobjects.scm +++ b/queries/fish/textobjects.scm @@ -1,4 +1,10 @@ -(function_definition) @function.outer +;; assignment +(command + name: (word) @_command + argument: (word) @_varname @assignment.lhs @assignment.inner + argument: (_)* @assignment.rhs + (#not-lua-match? @_varname "[-].*") + (#eq? @_command "set")) @assignment.outer (command name: (word) @_name diff --git a/queries/gdscript/textobjects.scm b/queries/gdscript/textobjects.scm new file mode 100644 index 0000000..d3420f3 --- /dev/null +++ b/queries/gdscript/textobjects.scm @@ -0,0 +1,59 @@ +(function_definition + body: (_) @function.inner) @function.outer + +(constructor_definition + body: (_) @function.inner) @function.outer + +(class_definition + body: (_) @class.inner) @class.outer + +(if_statement + body: (_) @conditional.inner) @conditional.outer + +(if_statement + alternative: (_ (_) @conditional.inner)?) @conditional.outer + +(if_statement + condition: (_) @conditional.inner) + +[ + (for_statement) + (while_statement) +] @loop.outer + +(while_statement body: (_) @loop.inner) + +(for_statement body: (_) @loop.inner) + +(comment) @comment.outer + +(parameters + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end + ) + +(parameters + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end + ) + +(arguments + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end + ) + +(arguments + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end + ) + +(array + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end + ) + +(array + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end + ) + diff --git a/queries/latex/textobjects.scm b/queries/latex/textobjects.scm index 98535e7..caf9a12 100644 --- a/queries/latex/textobjects.scm +++ b/queries/latex/textobjects.scm @@ -16,7 +16,28 @@ [ (generic_command) -] @statement.outer + (text_mode) +] @call.outer + +(text_mode + (curly_group + "{" + . + (_) @call.inner._start + (_)? @call.inner._end + . + "}") + ) + +(generic_command + (curly_group + "{" + . + (_) @call.inner._start + (_)? @call.inner._end + . + "}") + ) [ (chapter) diff --git a/queries/nim/textobjects.scm b/queries/nim/textobjects.scm new file mode 100644 index 0000000..f78b71e --- /dev/null +++ b/queries/nim/textobjects.scm @@ -0,0 +1,501 @@ +; ============================================================================== +; @attribute.inner +; @attribute.outer + +; ============================================================================== +; @function.inner +; @function.outer + +(proc_declaration body: (statement_list) @function.inner) @function.outer +(func_declaration body: (statement_list) @function.inner) @function.outer +(method_declaration body: (statement_list) @function.inner) @function.outer +(iterator_declaration body: (statement_list) @function.inner) @function.outer +(converter_declaration body: (statement_list) @function.inner) @function.outer +(template_declaration body: (statement_list) @function.inner) @function.outer +(macro_declaration body: (statement_list) @function.inner) @function.outer + +(proc_expression body: (statement_list) @function.inner) @function.outer +(func_expression body: (statement_list) @function.inner) @function.outer +(iterator_expression body: (statement_list) @function.inner) @function.outer + +; ============================================================================== +; @class.inner +; @class.outer + +; NOTE: seems pointless to handle just object declarations differently + +; ============================================================================== +; @conditional.inner +; @conditional.outer + +[ + (if) + (when) + (conditional_declaration) + (case) + (variant_declaration) + (elif_branch) + (else_branch) + (of_branch) +] @conditional.outer + +(if condition: (_) @conditional.inner) +(if consequence: (statement_list) @conditional.inner) +(when condition: (_) @conditional.inner) +(when consequence: (statement_list) @conditional.inner) +(conditional_declaration condition: (_) @conditional.inner) +(conditional_declaration consequence: (field_declaration_list) @conditional.inner) +(elif_branch condition: (_) @conditional.inner) +(elif_branch + consequence: [ + (statement_list) + (field_declaration_list) + ] @conditional.inner) +(else_branch + consequence: [ + (statement_list) + (field_declaration_list) + ] @conditional.inner) +(case value: (_) @conditional.inner) +(variant_declaration (variant_discriminator_declaration) @conditional.inner) +(of_branch values: (expression_list) @conditional.inner) +(of_branch + consequence: [ + (statement_list) + (field_declaration_list) + ] @conditional.inner) + +; ============================================================================== +; @loop.inner +; @loop.outer + +[ + (for) + (while) +] @loop.outer + +(for left: (_) @loop.inner._start right: (_) @loop.inner._end + ) +(for body: (statement_list) @loop.inner) +(while condition: (_) @loop.inner) +(while body: (statement_list) @loop.inner) + +; ============================================================================== +; @call.inner +; @call.outer + +(call (argument_list) @call.inner) @call.outer +; NOTE: parenthesis are included in @call.inner + +; ============================================================================== +; @block.inner +; @block.outer + +(case + ":" . (_) @block.inner._start + (_) @block.inner._end . + ) @block.outer + +(object_declaration (field_declaration_list) @block.inner) @block.outer +(tuple_type + . (field_declaration) @block.inner._start + (field_declaration)? @block.inner._end . + ) @block.outer +; BUG: @_end anchor not working correctly in all cases +(enum_declaration + . (enum_field_declaration) @block.inner._start + (enum_field_declaration)? @block.inner._end . + ) @block.outer +; BUG: @_end anchor not working correctly in all cases + +; using_section +; const_section +; let_section +; var_section +(_ + . (variable_declaration) @block.inner._start + (variable_declaration) @block.inner._end . + ) @block.outer +; BUG: @_end anchor not working correctly in all cases + +(type_section + . (type_declaration) @block.inner._start + (type_declaration) @block.inner._end . + ) @block.outer +; BUG: @_end anchor not working correctly in all cases + +; (pragma_statement) +; +; (while) +; (static_statement) +; (defer) +; +; (block) +; (if) +; (when) +; (case) +; (try) +; (for) +; +; (proc_declaration) +; (func_declaration) +; (method_declaration) +; (iterator_declaration) +; (macro_declaration) +; (template_declaration) +; (converter_declaration) +; +; (proc_expression) +; (func_expression) +; (iterator_expression) +; +; (concept_declaration) +; (of_branch) +; (elif_branch) +; (else_branch) +; (except_branch) +; (finally_branch) +; +; (do_block) +; (call) +(_ (statement_list) @block.inner) @block.outer + +; ============================================================================== +; @parameter.inner +; @parameter.outer + +; parameters when declaring +(parameter_declaration_list + ["," ";"] @parameter.outer._start . + (parameter_declaration) @parameter.inner @parameter.outer._end + ) + +(parameter_declaration_list + . (parameter_declaration) @parameter.inner @parameter.outer._start + . ["," ";"]? @parameter.outer._end +) + +; generic parameters when declaring +(generic_parameter_list + "," @parameter.outer._start . + (parameter_declaration) @parameter.inner @parameter.outer._end + ) + +(generic_parameter_list + . (parameter_declaration) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +; arguments when calling +(argument_list + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end +) + +(argument_list + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +; containers +(array_construction + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end + ) + +(array_construction + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end + ) + +(tuple_construction + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end + ) + +(tuple_construction + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end + ) + +(curly_construction + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end + ) + +(curly_construction + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end + ) + +; generic arguments when calling +; subscript operator +; generic types +(bracket_expression + right: + (argument_list + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end) + ) + +(bracket_expression + right: + (argument_list + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end) + ) + +; import x,x +; import except x,x +; include x,x +; from import x,x +; bind x,x +; mixin x,x +; case of x,x +; try except x,x +(expression_list + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end +) + +(expression_list + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +; pragmas +(pragma_list + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end +) + +(pragma_list + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +; variable_declaration +; for +; identifier_declaration `x,y: type = value` +(symbol_declaration_list + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end +) + +(symbol_declaration_list + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +; infix_expression +(infix_expression + operator: (_) @parameter.outer._start + right: (_) @parameter.inner @parameter.outer._end +) + +(infix_expression + left: (_) @parameter.inner @parameter.outer._start + operator: (_) @parameter.outer._end +) + +; tuple_type inline +(field_declaration_list + ["," ";"] @parameter.outer._start . + (field_declaration) @parameter.inner @parameter.outer._end +) + +(field_declaration_list + . (field_declaration) @parameter.inner @parameter.outer._start + . ["," ";"]? @parameter.outer._end +) + +; enum +(enum_declaration + "," @parameter.outer._start . + (enum_field_declaration) @parameter.inner @parameter.outer._end +) + +(enum_declaration + . (enum_field_declaration) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +; tuple_deconstruct_declaration +(tuple_deconstruct_declaration + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end +) + +(tuple_deconstruct_declaration + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +; concept parameter list +; concept refinement list +(parameter_list + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end +) + +(parameter_list + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +(refinement_list + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end +) + +(refinement_list + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +; dot_generic_call `v.call[:type, type]() +(generic_argument_list + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end +) + +(generic_argument_list + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end +) + +; ============================================================================== +; @regex.inner +; @regex.outer + +; ============================================================================== +; @comment.inner +; @comment.outer + +(comment (comment_content) @comment.inner) @comment.outer + +(block_comment (comment_content) @comment.inner) @comment.outer + +(documentation_comment (comment_content) @comment.inner) @comment.outer + +(block_documentation_comment (comment_content) @comment.inner) @comment.outer + +; ============================================================================== +; @assignment.inner +; @assignment.outer +; @assignment.lhs +; @assignment.rhs + +(variable_declaration + (symbol_declaration_list) @_symbols @assignment.lhs._start + type: (type_expression)? @_type @assignment.lhs._end + value: (_) @assignment.rhs @assignment.inner + ) @assignment.outer + +(type_declaration + (type_symbol_declaration) @assignment.lhs + . "=" + . (_) @assignment.rhs @assignment.inner) @assignment.outer + +(assignment + left: (_) @assignment.lhs + right: (_) @assignment.rhs @assignment.inner) @assignment.outer + +; default parameter in proc decl +; keyword argument in call +; array construction +(colon_expression + left: (_) @assignment.lhs + right: (_) @assignment.rhs @assignment.inner) @assignment.outer + +; object construction +; tuple construction +; table construction +(equal_expression + left: (_) @assignment.lhs + right: (_) @assignment.rhs @assignment.inner) @assignment.outer + +; object declaration fields +; tuple declaration fields +(field_declaration + (symbol_declaration_list) @_symbols @assignment.lhs._start + type: (type_expression)? @_type @assignment.lhs._end + value: (_)? @assignment.rhs @assignment.inner + ) @assignment.outer + +; enum types +(enum_field_declaration + (symbol_declaration) @assignment.lhs + "="? + value: (_)? @assignment.rhs @assignment.inner) @assignment.outer + + +; ============================================================================== +; @return.inner +; @return.outer + +(return_statement (_) @return.inner) @return.outer + +; ============================================================================== +; @statement.outer + +[ + ; simple + (import_statement) + (import_from_statement) + (export_statement) + (include_statement) + (discard_statement) + (return_statement) + (raise_statement) + (yield_statement) + (break_statement) + (continue_statement) + (assembly_statement) + (bind_statement) + (mixin_statement) + (pragma_statement) + + ; complex + (while) + (static_statement) + (defer) + + ; declarations + (proc_declaration) + (func_declaration) + (method_declaration) + (iterator_declaration) + (macro_declaration) + (template_declaration) + (converter_declaration) + (using_section) + (const_section) + (let_section) + (var_section) + (type_section) + + ; expression statements + (block) + (if) + (when) + (case) + (try) + (for) + (assignment) + ; NOTE: not including + ; simple_expression, call, infix_expression, prefix_expression + ; because it would confusing +] @statement.outer + +; ============================================================================== +; @scopename.inner + +; ============================================================================== +; @number.inner + +[ + (integer_literal) + (float_literal) +] @number.inner + diff --git a/queries/readline/textobjects.scm b/queries/readline/textobjects.scm new file mode 100644 index 0000000..aa099a1 --- /dev/null +++ b/queries/readline/textobjects.scm @@ -0,0 +1,20 @@ +(variable_setting) @statement.outer + +(comment) @comment.outer + +((comment) @comment.inner + (#offset! @comment.inner 0 1 0 0)) + +[ + (alternative) + (consequence) + (test) +] @conditional.inner + +(conditional_construct) @conditional.outer + +[ + (number_value) + (version_number) +] @number.inner + diff --git a/queries/rust/textobjects.scm b/queries/rust/textobjects.scm index 7ec5f7d..b6fe47d 100644 --- a/queries/rust/textobjects.scm +++ b/queries/rust/textobjects.scm @@ -57,19 +57,25 @@ ;; loops (loop_expression - (_)? @loop.inner) @loop.outer + body: (block . "{" . (_) @loop.inner._start [(_)","]? @loop.inner._end . "}" + )) @loop.outer (while_expression - (_)? @loop.inner) @loop.outer + body: (block . "{" . (_) @loop.inner._start [(_)","]? @loop.inner._end . "}" + )) @loop.outer (for_expression - body: (block)? @loop.inner) @loop.outer + body: (block . "{" . (_) @loop.inner._start [(_)","]? @loop.inner._end . "}" + )) @loop.outer ;; blocks (_ (block) @block.inner) @block.outer (unsafe_block (_)? @block.inner) @block.outer ;; calls +(macro_invocation) @call.outer +(macro_invocation (token_tree . "(" . (_) @call.inner._start (_)? @call.inner._end . ")" + )) (call_expression) @call.outer (call_expression arguments: (arguments . "(" . (_) @call.inner._start (_)? @call.inner._end . ")" @@ -185,13 +191,12 @@ . (_) @parameter.inner @parameter.outer._start . ","? @parameter.outer._end) ) -;; Disabled as not available in upstream language grammar repo (will need rust lang update) -;; ((token_tree -;; "," @parameter.outer._start . (_) @parameter.inner @parameter.outer._end) -;; ) -;; ((token_tree -;; . (_) @parameter.inner @parameter.outer._start . ","? @parameter.outer._end) -;; ) +((token_tree + "," @parameter.outer._start . (_) @parameter.inner @parameter.outer._end) + ) +((token_tree + . (_) @parameter.inner @parameter.outer._start . ","? @parameter.outer._end) + ) (scoped_use_list list: (use_list "," @parameter.outer._start . (_) @parameter.inner @parameter.outer._end diff --git a/queries/slang/textobjects.scm b/queries/slang/textobjects.scm new file mode 100644 index 0000000..882f511 --- /dev/null +++ b/queries/slang/textobjects.scm @@ -0,0 +1,14 @@ +; inherits: hlsl + +(template_declaration + (interface_specifier)) @class.outer.start + +(template_declaration + (extension_specifier)) @class.outer.start + +(extension_specifier + body: (_) @class.inner) @class.outer + +(interface_specifier + body: (_) @class.inner) @class.outer + diff --git a/queries/toml/textobjects.scm b/queries/toml/textobjects.scm index 7dd39af..2e16b2d 100644 --- a/queries/toml/textobjects.scm +++ b/queries/toml/textobjects.scm @@ -3,3 +3,31 @@ (float) ] @number.inner +((table + (pair) @parameter.inner @parameter.outer + )) + +((inline_table + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end + ) + ) + +((inline_table + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end + ) + ) + +((array + "," @parameter.outer._start . + (_) @parameter.inner @parameter.outer._end + ) + ) + +((array + . (_) @parameter.inner @parameter.outer._start + . ","? @parameter.outer._end + ) + ) + diff --git a/queries/typescript/textobjects.scm b/queries/typescript/textobjects.scm index 3c3c3a7..27bd00a 100644 --- a/queries/typescript/textobjects.scm +++ b/queries/typescript/textobjects.scm @@ -3,7 +3,7 @@ (interface_declaration) @class.outer (interface_declaration - body: (object_type . "{" . (_) @class.inner._start @class.inner._end _? @class.inner._end . "}" + body: (interface_body . "{" . (_) @class.inner._start @class.inner._end _? @class.inner._end . "}" )) (type_alias_declaration) @class.outer