syntaxTree not yet available

I have a decoration, which is almost identical in logic to the checkbox decoration example from the docs

https://codemirror.net/examples/decoration/

If the document is small, then it works as expected
But if the document is long, the syntax tree is not yet available on the first instantiation of the checkBox plugin.

I noted the ensureSyntaxTree function, but I wasn’t sure that was the right approach.

What would be the best way to handle this?

That example’s update method should have been checking for tree changes too. This patch adds that.

1 Like