Missing fold icons when setting large(ish) JSON as initial document

It seems that some fold gutter icons are missing when setting a large document programmatically.

const doc = `...`;

new EditorView({
  doc,
  extensions: [basicSetup, json()],
  parent: document.body,
});

When making the document slightly smaller, the fold icons that were missing in the large document pop in after a second or so. Perhaps there is some sort of parse timeout for the initial load?

The fold icons work fine when pasting the large document into the editor.

Here’s a minimal reproduction of the issue using basicSetup and json language that shows the large document (left) and smaller document (right).

https://codesandbox.io/p/sandbox/codemirror-fold-bug-dx9v88?file=%2Fsrc%2Findex.mjs%3A3%2C31

Yes, this is related to the parser not having found the end of the node. It would be bad to provide folding for nodes that we don’t know the extent of, since there’s no meaningful place to end the fold. As such, the fold system ignores partially parsed nodes. This is working as intended.

Is there any way to increase this, or force it to parse the entire document?

You can use forceParsing, but freezing the UI to get fold buttons may not be a great trade-off.

Noted. Thanks so much for the quick response!

For completeness, here’s what I did.

view = new EditorView({ ... });
forceParsing(view, 9e6, 100));

I increased the max upTo but kept the timeout at the default 100 ms so that it would get further on better hardware. Hopefully I’m understanding the function correctly!