I have a delay on my linter, which means that, when I open a document with errors in it, there’s a pause before errors are displayed.
I’ve found a way to hook into the onUpdate event to call forceLinting, which calls the linter immediately, but it doesn’t process the diagnostics returned by the linter. There’s still a pause before diagnostics are displayed. I’m using the ReactCodeMirror component, something like this:
<ReactCodeMirror
className={properties.className ?? ""}
basicSetup={{
lineNumbers: true,
highlightActiveLineGutter: true,
highlightSpecialChars: true,
history: true,
foldGutter: true,
drawSelection: true,
dropCursor: true,
indentOnInput: true,
bracketMatching: true,
closeBrackets: true,
autocompletion: true,
rectangularSelection: true,
crosshairCursor: true,
highlightActiveLine: true,
highlightSelectionMatches: true
}}
extensions={extensions}
value={text}
onUpdate={(viewUpdate) => {
if (opening) {
forceLinting(viewUpdate.view);
}
}}
onChange={(value) => {
text = value;
}}
/>