I am dynamically adding a unifiedMergeView effect as shown below but I couldn’t figure out how to dynamically remove it - can someone tell me how to do that?
Hi again. I have tried, with the help of the documentation and ai, to understand how this works, but I unfortunately wasn’t successful. Here’s the latest code that was suggested:
For this, I get Uncaught (in promise) Error: Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks. I checked but all @codemirror/state packages are deduped to @codemirror/state@6.5.2 ).
But I cannot remove the merge view afterwards without destroying the editor state, obviously.
Please advise, I am still struggling to understand the architecture and the example in the documentation, according to Gemini, is not suited to complex extensions such as the merge view. I tried and it did not work either. Maybe I did something wrong.
I recommend you stop trying to get the AI to make sense (it generally won’t, for questions that it hasn’t seen answered a hundred times) and read the link I gave you. It walks through a bit of code that reconfigures an editor.
Thank you for the fast feedback. For the record, what I did wrong was that I failed to include the compartment into list of extensions when the editor state is first configured, and instead tried to add it when showMergeView() was called. This works:
In this case, you are right that ai was useless and suggested nonsense. However, it had been very helpful for getting other stuff right about codemirror, probably where more examples existed on the web.