## Description
This uses `vim.treesitter.foldexpr` to get the start of a foldlevel,
because `vim.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 on `vim.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 if `vim.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 value `foldexpr` is actually set to.
PS2: I'm guessing the same thing happens when `foldexpr` is set to
`vim.lsp.foldexpr` and the ideal would be some way to distinguish which
one is currently active and then use either
`vim.treesitter.foldexpr(lnum):sub(1, 1) == ">"` or
`vim.lsp.foldexpr(lnum):sub(1, 1) == ">"` respectively.
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
## Related Issue(s)
Fixes#1533
<!--
If this PR fixes any issues, please link to the issue here.
- Fixes #<issue_number>
-->
## Screenshots
Before

After

<!-- Add screenshots of the changes if applicable. -->
---------
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
## Description
<!-- Describe the big picture of your changes to communicate to the
maintainers
why we should accept this pull request. -->
-
d972bc0a47
breaks cache key for virtual lines since `0 and 1 or 0` also evaluates
to 1 in lua.
## Related Issue(s)
<!--
If this PR fixes any issues, please link to the issue here.
- Fixes #<issue_number>
-->
- Fixes#510
## Screenshots
<!-- Add screenshots of the changes if applicable. -->