evil-textobj-tree-sitter
evil-textobj-tree-sitter copied to clipboard
Override `node` with `node.start` if available
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.startare optional decorations for the textobject like doctrings or template declarations. They will be added to the textobject range if present.
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