Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override node with node.start if available #39

Open
meain opened this issue Mar 6, 2022 · 1 comment
Open

Override node with node.start if available #39

meain opened this issue Mar 6, 2022 · 1 comment

Comments

@meain
Copy link
Owner

meain commented Mar 6, 2022

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
Copy link
Owner Author

meain commented Jun 19, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant