-
Notifications
You must be signed in to change notification settings - Fork 217
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
Treesitter offset directive has no effect #1446
Comments
Thanks for the suggestion! I can reproduce, but I'd not call it a "bug" per se since this was more or less experimental at the time 'mini.ai' was created. And I feel still is. But maybe there is a better tooling now to handle this. I'll take a look. |
There's a number of queries in nvim-treesitter-textobject that use Do you know what work is required for this? Happy to help if you're open to it. I considered this a bug in the sense that the behavior didn't match my expectations from reading Neovim's documentation. |
Probably some way of properly getting this offset information (in a backwards compatible down through Neovim 0.8 way; maybe have this only starting from some more recent version if the API is difficult) and apply it here. I think this should be it, but can't vouch for that. If you want to and have (lots of) free time, sure go ahead. But if not - no worries; I'll probably look at it this week. |
Ah I understand now why the offset is ignored. The directive stores the adjusted range in the capture metadata, whereas mini.ai only looks at the captured node. See the relevant code in nvim-treesitter-textobject. |
I see. That metadata behaving that exact way may be too recent. Needs an actual testing with earlier Neovim versions if that still works. |
It looks like the current metadata structure is used since 0.8.0 (neovim/neovim#18276). |
Contributing guidelines
Module(s)
mini.ai
Description
offset
directives in a Treesitter query have no effect when defined as a textobject withmini.ai
.The same query defined as a textobject with
nvim-treesitter-textobject
applies the offset as expected.Neovim version
0.10.3
Steps to reproduce
after/queries/lua/textobjects.scm:
mini.ai setup:
Test file:
{a}
Expected behavior
dix
should deletea
and leave{}
.Actual behavior
dix
deletes{a}
.The text was updated successfully, but these errors were encountered: