I have this code for swapping the whole document and retaining history
view.dispatch({
changes: {
from: 0,
to: view.state.doc.length,
insert: text,
},
});
is there a way to also change the language? like for example if I know the document is going to change from markdown to javascript?
My EditorView
is presently only configured for markdown, so I guess I have a second question as well – if I also add javascript, how does it know which language to use for highlighting?