Async autocomplete loading state

Hi there,

I am implementing autocomplete for a SQL-ish language, and as part of the autocomplete features, I want to add the ability to autocomplete filter values. So if I had code that looked like this:

WHERE z = 'foo'

it would make a call to the database to get all the valid values for z (if you were attempting to autocomplete z). I’ve successfully implemented that logic, but the UX right now is poor; depending on the amount of data, the network call to get values of z can take a second or two, but there is no affordance to the user that anything is happening while the call happens.

Ideally it would open the autocomplete as soon as the call is started with some sort of loading state (like a spinner), and when values come back, it would show the values to the user.

I’ve looked through the docs and I don’t believe this is something that is currently supported by the library. Is there any interest in supporting this case? My thinking is that, because this supports async completions, it seems reasonable to support a way of informing the user that it is waiting on async completions.

The idea is that autocompletion doesn’t get in your way until it actually has something to return. I’d say the root issue here is queries taking several seconds—maybe optimizing that is the most productive way to improve this. Of course, you could set up your completion source to show some kind of spinner while it is running (you’ll want to make sure you use the abort event to hide the spinner again), but for the moment I’m not convinced this is something the library should do.

That makes sense. Thank you for the tip about the abort event, I’ll look into that. Thanks!