Open oblitzitate opened 5 months ago
I was just about to create the same issue! Perhaps this could be solved by including leading block_continuation
in list_item
, instead of using the trailing one (i.e. the one on the next line)?
Here's an example of what I mean. The characters above the ^^
mark the captured block_continuation
and the ones above ~~~
the rest of the list_item
capture for the - Water
line.
Current behaviour where trailing block_continuation
is used:
- Elements
- Water
~~~~~~~
- Earth
^^
Desired behaviour where the leading block_continuation
is used:
- Elements
- Water
^^~~~~~~~
- Earth
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)tree-sitter 0.22.6 (b40f342067a89cd6331bf4c27407588320f3c263)
Describe the bug
When you operate on
list_item
as a text object (e.g. in neovim), it will not manipulate the document as expected. The issue arises because it containsblock_continuation
at its last part. See examples below.Steps To Reproduce/Bad Parse Tree
I set a query for the list item:
Then I set it as a textobject:
Given the following markdown document (with the cursor represented as
|
)...... if I apply "delete around/inside the list item textobject" at the cursor, I expect it to delete the
- Water
line, but instead it deletes the entire list:And if I apply it when the cursor is at the following...
...it will delete not just the
- Earth
part, but also the line under it, which is unexpected:The issue occurs because
list_item
encapsulates theblock_continuation
as the last part of its node.Expected Behavior/Parse Tree
I expected the first example to result in:
And I expected the second example to result in:
Repro
No response