meain/evil-textobj-tree-sitter

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

Opened this issue · 1 comments

meain commented

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 commented

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

nvim-treesitter/nvim-treesitter-textobjects@abaacef