We have implemented a yaml editor in our product that can switch between different yaml text documents. User can also make edits within each document as well. Due to this requirement it seems we are forced to dispatch changes when yamlDocument
changes.
The below dispatch runs when the user switches the yaml document in view or they type within the editor.
Which seems a bit inefficient and maybe there is a better way to handle this? In any case doing this on every change breaks auto completion. Is there a way to trigger auto completion to run after the dispatch occurs? Or is there a better solution than the one I have below?
view.dispatch({
changes: { from: 0, to: view.state.doc.length, insert: yamlDocument },
selection: {
anchor: cursorPosition,
head: cursorPosition,
}
});