Correct way of updating configuration from an extension?

I would like to create an extension that (after docChange) can reconfigure tagged extensions in the same EditorView. Obviously while the extension is running the EditorView is updating and i get an error regarding it.

What would be the proper way of implementing an extension like this?

Reconfiguring has to be done when creating a transaction, rather than when handling it. What kind of reconfiguration are you doing? It may be possible to do this as a transaction filter.

I want an editorview with an interchangeable LezerSyntax extension. I’ve created a ViewPlugin that checks if the document has changed (then runs some other checks as well) and i want to switch up the LezerSyntax extension from that ViewPlugin. But i am not able to dispatch a reconfiguration transaction from this ViewPlugin, because i get the said error.

That sounds very much like this example. Does that code help?

Yes, this is what i was looking for. Thank you very much!
I noticed that it is not called when i use the history() plugin and undo some changes. Althought the doc changes, the transactionFilter plugin is not called at all.

The history plugin passes filter: false when creating its transaction (because it would be hard to deal with undo transactions being changed before being applied)

Is there a way to work around this and check if the syntax has changed after undoing changes from the history?

Not yet. But it may be reasonable to change the filter setting on transactions to only apply to changes, not configuration and such. Not sure when I’ll get to that though.

Alright, thank you for your help!

This patch adds a transactionExtender facet that can be used in situations like this to make sure your logic runs even for transactions that have filtering disabled.

Awesome, thank you!