Is there a “proper” way to re-parse the existing content of the editor ? I’m currently doing it by putting the language in a compartment, and reconfiguring the compartment when I need to re-parse the content, but that feels a bit hacky.
The reason I want to do this is as follows.
My application has a kind of rule engine with its own DSL where (1) each expression in a rule is modeled by a separate single-line codemirror instance, (2) each expression has a result type (amongst other things) and (3) it is possible to refer to other expressions in an expression, but only if the referred expression has the correct result type.
If a referred expression is not of the correct result type, the syntax highlighter will display the expression in red to indicate an error.
That means that a change in one expression could affect the validity of the content of other editors, since changing an expression could change its result type. Therefore, other editors need to “watch” each other for certain changes and re-parse their contents when necessary. But so far, other than the hacky approach outlined below, I haven’t found a way to do this. Any ideas?