evil-textobj-tree-sitter icon indicating copy to clipboard operation
evil-textobj-tree-sitter copied to clipboard

Override `node` with `node.start` if available

Open meain opened this issue 3 years ago • 1 comments

We have a few nodes which could have overriding definitions in the same match (example). We have to override the inner one with .start one if this is present.

(decorated_definition
  (function_definition) @function.outer) @function.outer.start

In the above case, we have to use function.outer if function.outer.start is not available, but the latter otherwise and ignore function.outer. We have to remove the first one as otherwise we will have two starts for the same function.

@function.outer.start are optional decorations for the textobject like doctrings or template declarations. They will be added to the textobject range if present.

meain avatar Mar 06 '22 06:03 meain

Latest commit has also seems to have introduced things like function.end which gets combined optionally in ruby:

((method . name: (identifier) (method_parameters)? . (_) @function.inner (_)? @function.end .)
   (#make-range! "function.inner" @function.inner @function.end)) @function.outer
 ((singleton_method . name: (identifier) (method_parameters)? . (_) @function.inner (_)? @function.end .)
   (#make-range! "function.inner" @function.inner @function.end)) @function.outer

https://github.com/nvim-treesitter/nvim-treesitter-textobjects/commit/abaacefb1cde1e0d78e54194171c7981933a1849

meain avatar Jun 19 '22 07:06 meain