I am implementing content-based folding, such that a the content of the document dictates what gets folded - e.g imagine that a line prefixed with
[FOLD] will fold all its "child-node" lines in the AST.
It is currently implemented with
Decoration.replace, just like the code folding extension, but causes the viewport to fail to render some of the subsequent lines.
Here is an example implementation, which demonstrates the buggy rendering. You can copy and and paste it into
demo.ts, and then move the cursor down in the document to see the bug in action:
foldEffect directly does NOT cause this behavior, even though it uses the same Decoration.replace approach under the hood (you can try this by uncommenting the last five lines in the gist, which creates a foldEffect update on the view state).
@marijnh I'd very much appreciate your guidance in understanding what's going wrong here!