Code folding not re-evaluating on language update

I have a select box in order to select what language i want CM6 to parse as. For example if i start with ‘javascript’ and then in the code editor past in some HTML, then switch the language to ‘html’ like:

this.languageConf = new Compartment();
this.editorView.dispatch({
  effects: this.languageConf.reconfigure(html()),
});

The parsing and code highlighting changes correctly, but the folding doesn’t update. The only time it updates is when you add in some new text that would fold and you click the fold icon. Then the whole document updates for folding.

With CM6, is there an overall update() or something to update this? Can I specifically update just the folding?

Thanks!

What exactly do you mean by “the folding”? The folded text? The fold markers in the gutter? (The latter do seem to update. I’m not sure if I’d expect the former to update.)

Yes i am talking about code folding. Here is a quick video of what i am talking about. After i switch languages the code folding doesn’t refresh.

Ah, I see what you mean now. This patch should help.

1 Like