Counter-intuitive "editor.suggestSelection" behavior when completion is "kept open" #53959
Labels
suggest
IntelliSense, Auto Complete
under-discussion
Issue is under discussion for relevance, priority, approach
In the Haxe extension, we want to support the following two use cases:
identifier.|
- request completion for the fields withinidentifier
.some.package.|
- filter packages / types by the dot path that's currently being typed. In this case, the completion items don't change when typing a dot, so the suggest widget should simple be kept open (but filtered accordingly).To support of the first use case, we need to register
"."
as a trigger character, which means thatprovideCompletionItems()
is invoked for the other case as well, even though it wouldn't be necessary there. But so far so good, we can simply return the same completion items again to keep the suggest widget open, and adjust therange
of the items to match against the entire dot path typed so far.Here's a simple extension that simulates that:
This approach actually works quite well, but it causes an annoying interaction with the default behavior of
"editor.suggestSelection"
(default isrecentlyUsed
). If theJson - haxe.Json
entry has been selected before, it is auto-selected when typing the dot inhaxe.
:This might not look like a big issue there, but with many completion items between the packages and
haxe.Json
it's more problematic. The packages you were just filtering against are now scrolled totally out of view:Of course, this can be worked around with
"editor.suggestSelection": "first"
, but that's not a great experience for our users.preselect: true
also doesn't seem to help. Even if that's set for the"haxe.ds"
item in the sample code above, theJson
item is still auto-selected onhaxe.|
.I think the underlying issue here is that there isn't really a concept of "keeping the completion open / leaving the results unchanged", so VSCode thinks "ah, there were results, so this is must be a new completion and the
"editor.suggestSelection"
logic should be applied". Could the intention of keeping completion open be detected implicitly somehow, perhaps by comparing the previous to the currentprovideCompletionItems()
result? If so, the"editor.suggestSelection": "recentlyUsed"
step could be skipped in those cases.The text was updated successfully, but these errors were encountered: