fix: respect user-preferred flags when canceling completions #2541
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I haven't noticed this issue in practice (or if I did then it's subtle enough to not raise suspicion) but when looking at this code I've realized that the case when completions are canceled is not quite right since in that case we'd tell ST that we got empty completions and we'd pass the
sublime.AutoCompleteFlags.NONE
flag. The flag is the issue since we don't consider user's settings likeinhibit_snippet_completions
andinhibit_word_completions
so in the case when completions would get canceled, we'd let ST show buffer and snippet completions which is not what the user expects.It's kinda hard to test. I think this is only a potential issue for servers that return dynamic completions (like pyright) since then it's more likely that the completion request will get canceled on typing. But since pyright is very fast (at least in my small projects), it's hard to trigger that case (the new completions will come very fast after previous were canceled). I did a change like this to verify that what I said happens (user prefs are not respected):