Autocompletions dynamic loading

Hi, I’m using CodeMirror in Scastie which is online Scala playground and it is working perfectly. Thanks for all your hard work on it !
I’m looking for a way to load more completions dynamically when more inputs are added.

The case is eg:
I want to complete java.time.Instant. I start with writing I, and it is not on the list ( this is the expected result ). The language server running underneath need 3 letters to return it. So I continue with 2 more letters and now we have Ins. The completion list won’t be updated, as I have explicitly set validFor until the next capital letter or word.
It can easily be fixed by just removing the validFor and I’m fine with sending new requests to the server, but the problem is in the UI. It is now “flickering”, or more explicitly creating new completion window with new results.

Is there any way to add such “dynamic” loading of completions to the current completion list as user writes more letters ? It is currently possible to do manually with ctrl + space. Thanks for help.

Indeed, if you need your completion source to be queried for every letter typed, you really don’t want to use validFor. Are you using a recent version of @codemirror/autocomplete? Those should not flicker like that—the tooltip will be disabled-but-visible while waiting for the new set of completions.

Yeah, I updated the version and it seems to be working… Thanks for help !