Add C/C++ textobjects

This commit is contained in:
Stephan Seitz 2020-06-27 20:05:35 +02:00 committed by Thomas Vigouroux
parent d685d82682
commit 5e83307a43
2 changed files with 53 additions and 0 deletions

View file

@ -6,3 +6,50 @@
(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)

View file

@ -0,0 +1,6 @@
(class_specifier
body: (_) @class.inner) @class.outer
(for_range_loop
(_)? @loop.inner) @loop.outer