fix(statuscolumn): show open folds in consecutive levels #1534
+7
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This uses
vim.treesitter.foldexpr
to get the start of a foldlevel, becausevim.fn.foldlevel()
will return the same number in adjacent foldlevels, thus making the open fold markers inconsistent.This will however introduce a dependency on
vim.treesitter.foldexpr
and I haven't seen any other computations based onvim.treesitter
, so maybe this is not desirable?Unfortunately, I wasn't able to come up with a better solution, so feel free to disregard.
PS: I came across #1445 and this PR reverts those changes I realize. But I fail to find a good way for both to co-exist. I tried checking the value with
vim.api.nvim_get_option_value("foldexpr", {})
, but this will only work ifvim.opt.foldexpr
will be set directly into one of the 2. If it's set to another function that is required like in LazyVim, I'm not able to distinguish what valuefoldexpr
is actually set to.PS2: I'm guessing the same thing happens when
foldexpr
is set tovim.lsp.foldexpr
and the ideal would be some way to distinguish which one is currently active and then use eithervim.treesitter.foldexpr(lnum):sub(1, 1) == ">"
orvim.lsp.foldexpr(lnum):sub(1, 1) == ">"
respectively.Related Issue(s)
Fixes #1533
Screenshots
Before

After
