You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been doing some neorg module development (stemming from wanting to solve nvim-neorg/neorg#938), and came across an inconsistency in the range of list items in the tree-sitter tree I think might trip up others. Possibly this is an expected feature, in which case I can code around it, but I wanted to post here in case a change in the tree-sitter parser might be the best ultimate fix. (I'm new to Neorg and to Neovim plugin development, I apologize for misunderstandings I might have in posting this here.)
I'll talk about unordered lists, but the same behavior applies to ordered lists.
Summary of the issue: The range of a node with type unordered_list1 (corresponding to an unordered list item) is 1 line shorter if the list item is followed by an empty line than if the list item is followed by a line with any content or no lines (i.e. end of buffer). For list items that only span a single line each, the situation for list items followed by another list item, a heading, a quote, or end of file are that the start and end rows of the range have a difference of 1; but for a list item followed by an empty line, the range start and end rows are the same. An analogous situation occurs with list items spanning multiple lines; the range spans multiple rows, but spans one less row when the item is followed by an empty line).
This behavior seems undesirable because it requires code that operate on list items to act differently depending on whether the item is followed by an empty line.
I've been doing some neorg module development (stemming from wanting to solve nvim-neorg/neorg#938), and came across an inconsistency in the range of list items in the tree-sitter tree I think might trip up others. Possibly this is an expected feature, in which case I can code around it, but I wanted to post here in case a change in the tree-sitter parser might be the best ultimate fix. (I'm new to Neorg and to Neovim plugin development, I apologize for misunderstandings I might have in posting this here.)
I'll talk about unordered lists, but the same behavior applies to ordered lists.
Summary of the issue: The range of a node with type
unordered_list1
(corresponding to an unordered list item) is 1 line shorter if the list item is followed by an empty line than if the list item is followed by a line with any content or no lines (i.e. end of buffer). For list items that only span a single line each, the situation for list items followed by another list item, a heading, a quote, or end of file are that the start and end rows of the range have a difference of 1; but for a list item followed by an empty line, the range start and end rows are the same. An analogous situation occurs with list items spanning multiple lines; the range spans multiple rows, but spans one less row when the item is followed by an empty line).This behavior seems undesirable because it requires code that operate on list items to act differently depending on whether the item is followed by an empty line.
I'll illustrate with some small files.
For this file,
:InspectTree
returns the following tree:For this file (same but without the final empty line)
:InspectTree
returns the following tree:For this file
we get the following tree:
The text was updated successfully, but these errors were encountered: