Use more appropriate action for Vim word completions (#28043)

Follow-up of https://github.com/zed-industries/zed/pull/26410

The action does not sort the items the way Vim does, but still better
than the previous state.

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Kirill Bulatov 2025-04-03 13:32:24 -06:00 committed by GitHub
parent 2086f7d85b
commit 3f71ae9897
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 8 deletions

View file

@ -4377,7 +4377,7 @@ impl Editor {
);
let words = match completion_settings.words {
WordsCompletionMode::Disabled => Task::ready(HashMap::default()),
WordsCompletionMode::Disabled => Task::ready(BTreeMap::default()),
WordsCompletionMode::Enabled | WordsCompletionMode::Fallback => cx
.background_spawn(async move {
buffer_snapshot.words_in_range(WordsQuery {
@ -4404,7 +4404,7 @@ impl Editor {
let sort_completions = provider
.as_ref()
.map_or(true, |provider| provider.sort_completions());
.map_or(false, |provider| provider.sort_completions());
let filter_completions = provider
.as_ref()
@ -4421,7 +4421,7 @@ impl Editor {
if let Some(provided_completions) = provided_completions.await.log_err().flatten() {
completions.extend(provided_completions);
if completion_settings.words == WordsCompletionMode::Fallback {
words = Task::ready(HashMap::default());
words = Task::ready(BTreeMap::default());
}
}