mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 18:00:07 -04:00
Remove textobjects module
This commit is contained in:
parent
7f325538cc
commit
3362f45196
16 changed files with 0 additions and 779 deletions
|
|
@ -1,58 +0,0 @@
|
|||
;; TODO: supported by official Tree-sitter if (_)* is more than one node
|
||||
;; Neovim: will only match if (_) is exactly one node
|
||||
;(function_definition
|
||||
;body: (compound_statement
|
||||
;("{" (_)* @function.inner "}"))?) @function.outer
|
||||
|
||||
(function_definition
|
||||
body: (compound_statement) @function.inner) @function.outer
|
||||
|
||||
(struct_specifier
|
||||
body: (_) @class.inner) @class.outer
|
||||
|
||||
; conditional
|
||||
(if_statement
|
||||
consequence: (_)? @conditional.inner
|
||||
alternative: (_)? @conditional.inner
|
||||
) @conditional.outer
|
||||
|
||||
(if_statement
|
||||
condition: (_) @conditional.inner)
|
||||
|
||||
; loops
|
||||
(for_statement
|
||||
(_)? @loop.inner) @loop.outer
|
||||
(while_statement
|
||||
(_)? @loop.inner) @loop.outer
|
||||
(do_statement
|
||||
(_)? @loop.inner) @loop.outer
|
||||
|
||||
|
||||
(compound_statement) @block.outer
|
||||
(comment) @comment.outer
|
||||
|
||||
(call_expression) @call.outer
|
||||
(call_expression (_) @call.inner)
|
||||
|
||||
; Statements
|
||||
|
||||
;(expression_statement ;; this is what we actually want to capture in most cases (";" is missing) probaly
|
||||
;(_) @statement.inner) ;; the otther statement like node type is declaration but declaration has a ";"
|
||||
|
||||
(compound_statement
|
||||
(_) @statement.outer)
|
||||
|
||||
(field_declaration_list
|
||||
(_) @statement.outer)
|
||||
|
||||
(preproc_if
|
||||
(_) @statement.outer)
|
||||
|
||||
(preproc_elif
|
||||
(_) @statement.outer)
|
||||
|
||||
(preproc_else
|
||||
(_) @statement.outer)
|
||||
|
||||
(parameter_list
|
||||
(parameter_declaration) @parameter.inner)
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
(method_declaration
|
||||
body: (block) ? @function.inner) @function.outer
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
(class_specifier
|
||||
body: (_) @class.inner) @class.outer
|
||||
|
||||
(for_range_loop
|
||||
(_)? @loop.inner) @loop.outer
|
||||
|
||||
(template_declaration
|
||||
(function_definition) @function.outer) @function.outer.start
|
||||
|
||||
(template_declaration
|
||||
(struct_specifier) @class.outer) @class.outer.start
|
||||
|
||||
(template_declaration
|
||||
(class_specifier) @class.outer) @class.outer.start
|
||||
|
||||
(parameter_list
|
||||
(optional_parameter_declaration) @parameter.inner)
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
;; function textobject
|
||||
(function_declaration
|
||||
body: (block)? @function.inner) @function.outer
|
||||
|
||||
;; function literals
|
||||
(func_literal
|
||||
(_)? @function.inner) @function.outer
|
||||
|
||||
;; method as function textobject
|
||||
(method_declaration
|
||||
body: (block)? @function.inner) @function.outer
|
||||
|
||||
;; struct and interface declaration as class textobject?
|
||||
(type_declaration
|
||||
(type_spec (type_identifier) (struct_type (field_declaration_list (_)?) @class.inner))) @class.outer
|
||||
|
||||
(type_declaration
|
||||
(type_spec (type_identifier) (interface_type (method_spec_list (_)?) @class.inner))) @class.outer
|
||||
|
||||
;; struct literals as class textobject
|
||||
(composite_literal
|
||||
(type_identifier)?
|
||||
(struct_type (_))?
|
||||
(literal_value (_)) @class.inner) @class.outer
|
||||
|
||||
;; conditionals
|
||||
(if_statement
|
||||
alternative: (_ (_) @conditional.inner)?) @conditional.outer
|
||||
|
||||
(if_statement
|
||||
consequence: (block)? @conditional.inner)
|
||||
|
||||
(if_statement
|
||||
condition: (_) @conditional.inner)
|
||||
|
||||
;; loops
|
||||
(for_statement
|
||||
body: (block)? @loop.inner) @loop.outer
|
||||
|
||||
;; blocks
|
||||
(_ (block) @block.inner) @block.outer
|
||||
|
||||
;; statements
|
||||
(block (_) @statement.outer)
|
||||
|
||||
;; comments
|
||||
(comment) @comment.outer
|
||||
|
||||
;; calls
|
||||
(call_expression (_)? @call.inner) @call.outer
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
(function_declaration
|
||||
body: (statement_block) @function.inner) @function.outer
|
||||
|
||||
(export_statement
|
||||
(function_declaration) @function.outer) @function.outer.start
|
||||
|
||||
(arrow_function
|
||||
body: (_) @function.inner) @function.outer
|
||||
|
||||
(method_definition
|
||||
body: (statement_block) @function.inner) @function.outer
|
||||
|
||||
(class_declaration
|
||||
body: (class_body) @class.inner) @class.outer
|
||||
|
||||
(export_statement
|
||||
(class_declaration) @class.outer) @class.outer.start
|
||||
|
||||
(for_in_statement
|
||||
body: (_)? @loop.inner) @loop.outer
|
||||
|
||||
(while_statement
|
||||
body: (_)? @loop.inner) @loop.outer
|
||||
|
||||
(do_statement
|
||||
body: (_)? @loop.inner) @loop.outer
|
||||
|
||||
(if_statement
|
||||
consequence: (_)? @conditional.inner
|
||||
alternative: (_)? @conditional.inner) @conditional.outer
|
||||
|
||||
(switch_statement
|
||||
body: (_)? @conditional.inner) @conditional.outer
|
||||
|
||||
(call_expression) @call.outer
|
||||
(call_expression (arguments) @call.inner)
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
(function) @function.outer
|
||||
|
||||
(local_function) @function.outer
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
(function_definition
|
||||
body: (block)? @function.inner) @function.outer
|
||||
|
||||
(decorated_definition
|
||||
(function_definition) @function.outer) @function.outer.start
|
||||
|
||||
(class_definition
|
||||
body: (block)? @class.inner) @class.outer
|
||||
|
||||
(decorated_definition
|
||||
(class_definition) @class.outer) @class.outer.start
|
||||
|
||||
(while_statement
|
||||
body: (block)? @loop.inner) @loop.outer
|
||||
|
||||
(for_statement
|
||||
body: (block)? @loop.inner) @loop.outer
|
||||
|
||||
(if_statement
|
||||
alternative: (_ (_) @conditional.inner)?) @conditional.outer
|
||||
|
||||
(if_statement
|
||||
consequence: (block)? @conditional.inner)
|
||||
|
||||
(if_statement
|
||||
condition: (_) @conditional.inner)
|
||||
|
||||
(_ (block) @block.inner) @block.outer
|
||||
(comment) @comment.outer
|
||||
|
||||
(block (_) @statement.outer)
|
||||
|
||||
(call) @call.outer
|
||||
(call (_) @call.inner)
|
||||
|
||||
;; Parameters
|
||||
(parameters
|
||||
[(identifier)
|
||||
(tuple)
|
||||
(typed_parameter)
|
||||
(default_parameter)
|
||||
(typed_default_parameter)
|
||||
(list_splat)
|
||||
(dictionary_splat)] @parameter.inner)
|
||||
|
||||
(lambda_parameters
|
||||
[(identifier)
|
||||
(tuple)
|
||||
(typed_parameter)
|
||||
(default_parameter)
|
||||
(typed_default_parameter)
|
||||
(list_splat)
|
||||
(dictionary_splat)] @parameter.inner)
|
||||
|
||||
; TODO: exclude comments using the future negate syntax from tree-sitter
|
||||
(argument_list (_) @parameter.inner)
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
(directive
|
||||
body: (body) @function.inner) @function.outer
|
||||
|
||||
(section (title) @class.inner) @class.outer
|
||||
|
||||
(transition) @class.outer
|
||||
|
||||
[
|
||||
(bullet_list)
|
||||
(enumerated_list)
|
||||
(definition_list)
|
||||
(field_list)
|
||||
|
||||
(literal_block)
|
||||
(line_block)
|
||||
(block_quote)
|
||||
(doctest_block)
|
||||
] @block.outer
|
||||
|
||||
(footnote
|
||||
body: (body) @block.inner) @block.outer
|
||||
|
||||
(citation
|
||||
body: (body) @block.inner) @block.outer
|
||||
|
||||
(target
|
||||
link: (link) @block.inner) @block.outer
|
||||
|
||||
(substitution_definition
|
||||
body: (body) @block.inner) @block.outer
|
||||
|
||||
(comment) @comment.outer
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
;; functions
|
||||
(function_item
|
||||
(_) @function.inner) @function.outer
|
||||
|
||||
;; quantifies as class(es)
|
||||
(struct_item
|
||||
(_) @class.inner) @class.outer
|
||||
|
||||
(enum_item
|
||||
(_) @class.inner) @class.outer
|
||||
|
||||
(union_item
|
||||
(_) @class.inner) @class.outer
|
||||
|
||||
(trait_item
|
||||
(_) @class.inner) @class.outer
|
||||
|
||||
(impl_item
|
||||
(_) @class.inner) @class.outer
|
||||
|
||||
;; conditionals
|
||||
(if_expression
|
||||
alternative: (_ (_)? @conditional.inner)?
|
||||
) @conditional.outer
|
||||
|
||||
(if_expression
|
||||
alternative: (block)? @conditional.inner)
|
||||
|
||||
(if_expression
|
||||
condition: (_) @conditional.inner)
|
||||
|
||||
(if_expression
|
||||
consequence: (block)? @conditional.inner)
|
||||
|
||||
(match_arm
|
||||
(_)) @conditional.inner
|
||||
|
||||
(match_expression
|
||||
(match_arm)?
|
||||
) @conditional.outer
|
||||
|
||||
(if_let_expression
|
||||
consequence: (block)?
|
||||
@conditional.inner) @conditional.outer
|
||||
|
||||
(if_let_expression
|
||||
alternative: (block)? @conditional.inner)
|
||||
|
||||
(if_let_expression
|
||||
condition: (_) @conditional.inner)
|
||||
|
||||
;; loops
|
||||
(loop_expression
|
||||
(_)? @loop.inner) @loop.outer
|
||||
|
||||
(while_expression
|
||||
(_)? @loop.inner) @loop.outer
|
||||
|
||||
(while_let_expression
|
||||
(_)? @loop.inner) @loop.outer
|
||||
|
||||
(for_expression
|
||||
body: (block)? @loop.inner) @loop.outer
|
||||
|
||||
;; blocks
|
||||
(_ (block) @block.inner) @block.outer
|
||||
(unsafe_block (_)? @block.inner) @block.outer
|
||||
|
||||
;; calls
|
||||
(call_expression (_)? @call.inner) @call.outer
|
||||
|
||||
;; statements
|
||||
(block (_) @statement.outer)
|
||||
Loading…
Add table
Add a link
Reference in a new issue