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

Changes needed for Neovim folding #91

Open
ixru opened this issue Mar 12, 2023 · 2 comments
Open

Changes needed for Neovim folding #91

ixru opened this issue Mar 12, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ixru
Copy link

ixru commented Mar 12, 2023

Continuation of nvim-treesitter/nvim-treesitter#3442

image

Image shows highlighted the relevant part, marked by the cursor.

What would solve the problem is if the block_continuation whitespace was moved from belonging to the paragraphs to belonging to the list items. The block_continuation at line 24, to belong to the list_item at line 25 (last part of highlight). 7 -> 9 (first part of highlight), and so with all the others. I don't know what purpose it serves, so I rely on you.

I also notice how the block continuation at line 7 is split, half to the continuation half to the marker, this is what makes me suspicious of the placement of block_continuation.

@ixru ixru added the bug Something isn't working label Mar 12, 2023
@MDeiml
Copy link
Collaborator

MDeiml commented Mar 12, 2023

The block continuation problem is a bit non trivial because it's not always possible to put the corresponding nodes into the blocks they actually belong to. Think about a list item with a paragraph that's more than 1 line: the continuations in the middle would all need to belong to the paragraph and not the list items.

But it should be possible to make it more consistent for your use case. I guess you could specify it like this:

"All block continuations on a line should belong to the outermost node, that is open and does not close on this line, and that was open on the last line"

Or in other words, block continuations should never be the last part of a block, there should always be a line break in the same block somewhere later.

@MDeiml
Copy link
Collaborator

MDeiml commented Mar 12, 2023

I'll see how it's possible to implement this, but shouldn't be all to hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants