How to ensure all possible completions are shown again after backspacing until the trigger character?

For our editor, I am trying to match the backspace autocomplete behaviour of vscode. In vscode, when you type an object’s name and then a dot, it will list all possible properties on that object. If you start typing it will filter that list down. And if you backspace until the dot, it will show all possible options again.

VSCodeAutocompleteBackspacingBehaviour

In codemirror, this only partially works. When I type an object’s name and a dot, it shows all possible properties on that object. Then I start typing and the list filters down. However, when I backspace everything I’ve typed until the dot, the autocomplete popup just closes instead of showing the full list again.

CodemirrorAutocompleteBackspacingBehaviour

My validFor regex should return true for an empty string (validFor: /^\w*$/), so I’m not sure why the popup is closing instead of showing all the options again. Is there some other parameter I should be using to handle this?

Here is an extremely reduced example case:

https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2F1dG9jb21wbGV0aW9ufSBmcm9tICJAY29kZW1pcnJvci9hdXRvY29tcGxldGUiCgpjb25zdCBjb21wbGV0aW9ucyA9IFsKICB7bGFiZWw6ICJmb28iLCB0eXBlOiAidmFyaWFibGUifSwKICB7bGFiZWw6ICJiYXIiLCB0eXBlOiAidmFyaWFibGUifSwKICB7bGFiZWw6ICJiYXoiLCB0eXBlOiAidmFyaWFibGUifSwKXQoKZnVuY3Rpb24gbXlDb21wbGV0aW9ucyhjb250ZXh0KSB7CiAgbGV0IGJlZm9yZSA9IGNvbnRleHQubWF0Y2hCZWZvcmUoL1x3Ky8pOwogIHJldHVybiB7CiAgICBmcm9tOiBiZWZvcmUgPyBiZWZvcmUuZnJvbSA6IGNvbnRleHQucG9zLAogICAgb3B0aW9uczogY29tcGxldGlvbnMsCiAgICB2YWxpZEZvcjogL15cdyokLwogIH0KfQoKbGV0IHZpZXcgPSBuZXcgRWRpdG9yVmlldyh7CiAgZG9jOiAiLy8gVHJ5IHR5cGluZyBgb2JqLmJhcmAgYW5kIHRoZW4gYmFja3NwYWNlIHVudGlsIGBvYmouYFxuLy8gKE5vdGljZSB0aGF0IHRoZSBhdXRvY29tcGxldGUgcG9wdXAgY2xvc2VzIGluc3RlYWQgb2YgZGlzcGxheWluZyB0aGUgYGJhcmAsIGBiYXpgLCBgZm9vYCBvcHRpb25zIGFnYWluLilcbiIsCiAgZXh0ZW5zaW9uczogWwogICAgYmFzaWNTZXR1cCwKICAgIGF1dG9jb21wbGV0aW9uKHtvdmVycmlkZTogW215Q29tcGxldGlvbnNdfSkKICBdLAogIHBhcmVudDogZG9jdW1lbnQuYm9keQp9KQo=

That wasn’t intentional behavior. This patch should help.

Thanks for the quick response!

Sorry, which patch is it fixed in? Did you mean to post a link to it?

I pasted the wrong link. I’ve edited my post above.

Thanks!

I’ll wait for the package version to be bumped so I can test it on my end.

I’ve tagged @codemirror/autocomplete 6.18.3

Upgraded, tested, and it works perfectly! Thanks!