mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-13 05:42:59 +00:00
Trigger completions even if inline completion is visible (#22077)
This is related to #22069 and #21858: before both of these PRs, we would only ever show inline completions OR completions, never both at the same time. Now we show both at the same, but we still had this piece of logic here, that prevented non-inline completions from showing up if there was already an inline completion. With this change, it's possible to get LSP completions without having to dismiss inline completions before. Release Notes: - Inline completions (Copilot, Supermaven, ...) don't stop other completions from showing up anymore. Both can now be visible at the same time. --------- Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
parent
ce727fbc07
commit
ea012075fc
2 changed files with 12 additions and 3 deletions
|
@ -373,6 +373,17 @@ mod tests {
|
||||||
|
|
||||||
// Ensure existing inline completion is interpolated when inserting again.
|
// Ensure existing inline completion is interpolated when inserting again.
|
||||||
cx.simulate_keystroke("c");
|
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();
|
executor.run_until_parked();
|
||||||
cx.update_editor(|editor, cx| {
|
cx.update_editor(|editor, cx| {
|
||||||
assert!(!editor.context_menu_visible());
|
assert!(!editor.context_menu_visible());
|
||||||
|
|
|
@ -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| {
|
this.change_selections_inner(Some(Autoscroll::fit()), false, cx, |s| {
|
||||||
s.select(new_selections)
|
s.select(new_selections)
|
||||||
});
|
});
|
||||||
|
@ -2864,8 +2863,7 @@ impl Editor {
|
||||||
this.show_signature_help(&ShowSignatureHelp, cx);
|
this.show_signature_help(&ShowSignatureHelp, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
let trigger_in_words = !had_active_inline_completion;
|
this.trigger_completion_on_input(&text, true, cx);
|
||||||
this.trigger_completion_on_input(&text, trigger_in_words, cx);
|
|
||||||
linked_editing_ranges::refresh_linked_ranges(this, cx);
|
linked_editing_ranges::refresh_linked_ranges(this, cx);
|
||||||
this.refresh_inline_completion(true, false, cx);
|
this.refresh_inline_completion(true, false, cx);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue