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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 61 additions and 34 deletions

View file

@ -2081,7 +2081,7 @@ impl ContextEditor {
}
editor.insert(&format!("/{name}"), cx);
if command.requires_argument() {
if command.accepts_arguments() {
editor.insert(" ", cx);
editor.show_completions(&ShowCompletions::default(), cx);
}
@ -2094,6 +2094,10 @@ impl ContextEditor {
}
pub fn confirm_command(&mut self, _: &ConfirmCommand, cx: &mut ViewContext<Self>) {
if self.editor.read(cx).has_active_completions_menu() {
return;
}
let selections = self.editor.read(cx).selections.disjoint_anchors();
let mut commands_by_range = HashMap::default();
let workspace = self.workspace.clone();