Stop autocomplete from blinking on typing

I use @codemirror/autocomplete and when I type, the window disappears and appears briefly on typing.

What I can do to make it stop blinking?

The validFor property of completion objects might be useful here.

1 Like

But will it cause the source not to be refreshed?

I need to fetch the new autocomplete items on type, just not cause it to blink.

If you need to asynchronously fetch the items, you’re going to be stuck with the blinking. If you can just get all the completions valid at a given position right away, and then use validFor (or update) to synchronously get a new set of valid completions you can avoid it.

I have a set of about a milion options for the autocomplete, when I type in first few characters, I perform a network request, and it fetches the first 100 values.

Then, I’ld like to type in the next character, start a new request for the new word, have the window not disappear, let the request end, and then update the available results.

In the documentation CodeMirror 6 Reference Manual there is written that update():

Synchronously update the completion result after typing or deletion. If given, this should not do any expensive work, since it will be called during editor state updates.

It says that it shouldn’t do any heavy work, but I need to start another reuqest for more options.


What if I wanted to keep the autocomplete window open for the duration of the request. Would that mean the editor is unresponsive as long as the requests is fetching?

I’d like just to voice my concern that this issue should be resolved, as I have to resort to using monaco (though only for desktop) until it gets fixed.

(p.s. I’m using codemirror on mobile because monaco does not work there. But I prefer codemirror all the way!)

@da-x How did you manage to get the autocomplete to stop blinking?

@Danon I didn’t get this fixed. Just wanted to point out that monaco does not exhibit the same issue.