Force linting immediately

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;
        }}
    />

There is always a Promise.resolve happening in the lint result query, so it’ll never act synchronously. But if your linter itself is synchronous, it should happen on the next tick, which should be really fast.

There turns out to have been something wrong with my logic in the management of the opening variable. It’s working now; thanks for your time.