mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
20 lines
568 B
TypeScript
20 lines
568 B
TypeScript
import { Annotation } from '@codemirror/state';
|
|
import type { EditorView } from '@codemirror/view';
|
|
|
|
export const ignoreUpdateAnnotation = Annotation.define<boolean>();
|
|
|
|
/**
|
|
* Simulate user action to force parser to catch up during scroll.
|
|
*/
|
|
export function forceParse(view: EditorView) {
|
|
view.dispatch({
|
|
changes: { from: view.viewport.to, insert: '_' },
|
|
annotations: [ignoreUpdateAnnotation.of(true)],
|
|
});
|
|
|
|
view.dispatch({
|
|
changes: { from: view.viewport.to - 1, to: view.viewport.to, insert: '' },
|
|
annotations: [ignoreUpdateAnnotation.of(true)],
|
|
});
|
|
}
|