diff --git a/queries/verilog/textobjects.scm b/queries/verilog/textobjects.scm index 600125a1..ff3d1ee2 100644 --- a/queries/verilog/textobjects.scm +++ b/queries/verilog/textobjects.scm @@ -1,17 +1,48 @@ -[ - (loop_generate_construct) - (loop_statement) -] @loop.outer +(function_declaration + (function_body_declaration + (tf_port_list) + . + (_) @_start @_end + (_)? @_end + . + "endfunction" + (#make-range! "function.inner" @_start @_end))) @function.outer -[ - (conditional_statement) - (case_item) -] @conditional.outer +(task_declaration + (task_body_declaration + (tf_port_list) + . + (_) @_start @_end + (_)? @_end + . + "endtask" + (#make-range! "function.inner" @_start @_end))) @function.outer -(comment) @comment.outer +[ + (seq_block) + (generate_block) +] @block.outer -(function_declaration) @function.outer +(seq_block + "begin" + (simple_identifier)? + . + (_) @_start @_end + (#not-kind-eq? @_start "simple_identifier") + (_)? @_end + . + "end" + (#make-range! "block.inner" @_start @_end)) -(always_construct) @block.outer +(generate_block + "begin" + (simple_identifier)? + . + (_) @_start @_end + (#not-kind-eq? @_start "simple_identifier") + (_)? @_end + . + "end" + (#make-range! "block.inner" @_start @_end)) -(module_declaration) @class.outer +(comment) @comment.outer