Run slash commands both on enter and on argument completion that requires it (#16283)

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov
2024-08-15 19:36:30 +03:00
committed by GitHub
parent 5a30e29848
commit c45adce2e3
9 changed files with 61 additions and 34 deletions
+11 -6
View File
@@ -4379,11 +4379,11 @@ impl Editor {
this.refresh_inline_completion(true, cx);
});
if let Some(confirm) = completion.confirm.as_ref() {
(confirm)(intent, cx);
}
if completion.show_new_completions_on_confirm {
let show_new_completions_on_confirm = completion
.confirm
.as_ref()
.map_or(false, |confirm| confirm(intent, cx));
if show_new_completions_on_confirm {
self.show_completions(&ShowCompletions { trigger: None }, cx);
}
@@ -11926,6 +11926,12 @@ impl Editor {
let bounds = self.last_bounds?;
Some(element::gutter_bounds(bounds, self.gutter_dimensions))
}
pub fn has_active_completions_menu(&self) -> bool {
self.context_menu.read().as_ref().map_or(false, |menu| {
menu.visible() && matches!(menu, ContextMenu::Completions(_))
})
}
}
fn hunks_for_selections(
@@ -12141,7 +12147,6 @@ fn snippet_completions(
..Default::default()
},
confirm: None,
show_new_completions_on_confirm: false,
})
})
.collect()