Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Trigger completions even if inline completion is visible (#22077)

Thorsten Ballea012075fc8b
diff --git a/crates/copilot/src/copilot_completion_provider.rs b/crates/copilot/src/copilot_completion_provider.rs
index 949e2178a6f..730401adc77 100644
--- a/crates/copilot/src/copilot_completion_provider.rs
+++ b/crates/copilot/src/copilot_completion_provider.rs
@@ -373,6 +373,17 @@ mod tests {
// Ensure existing inline completion is interpolated when inserting again.
cx.simulate_keystroke("c");
+ // We still request a normal LSP completion, but we interpolate the
+ // existing inline completion.
+ drop(handle_completion_request(
+ &mut cx,
+ indoc! {"
+ one.c|<>
+ two
+ three
+ "},
+ vec!["ompletion_a", "ompletion_b"],
+ ));
executor.run_until_parked();
cx.update_editor(|editor, cx| {
assert!(!editor.context_menu_visible());
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index f0a4320c66a..0979f1cc701 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -2843,7 +2843,6 @@ impl Editor {
);
}
- let had_active_inline_completion = this.has_active_inline_completion();
this.change_selections_inner(Some(Autoscroll::fit()), false, cx, |s| {
s.select(new_selections)
});
@@ -2864,8 +2863,7 @@ impl Editor {
this.show_signature_help(&ShowSignatureHelp, cx);
}
- let trigger_in_words = !had_active_inline_completion;
- this.trigger_completion_on_input(&text, trigger_in_words, cx);
+ this.trigger_completion_on_input(&text, true, cx);
linked_editing_ranges::refresh_linked_ranges(this, cx);
this.refresh_inline_completion(true, false, cx);
});