Skip to content

Commit

Permalink
edit predictions: Don't animate cursor when jumping in eager mode wit…
Browse files Browse the repository at this point in the history
…hout LSP completions (#24664)

We should only do this in "holding modifier" mode OR when there's a
language server completions menu.

Release Notes:

- N/A
  • Loading branch information
agu-z authored Feb 11, 2025
1 parent b395bea commit 14d9788
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5457,19 +5457,27 @@ impl Editor {
};

if &accept_keystroke.modifiers == modifiers {
if let Some(completion) = self.active_inline_completion.as_ref() {
if self.edit_prediction_preview.start(
&completion.completion,
&position_map.snapshot,
self.selections
.newest_anchor()
.head()
.to_display_point(&position_map.snapshot),
) {
self.request_autoscroll(Autoscroll::fit(), cx);
self.update_visible_inline_completion(window, cx);
cx.notify();
}
let Some(completion) = self.active_inline_completion.as_ref() else {
return;
};

if !self.edit_prediction_requires_modifier() && !self.has_visible_completions_menu() {
return;
}

let transitioned = self.edit_prediction_preview.start(
&completion.completion,
&position_map.snapshot,
self.selections
.newest_anchor()
.head()
.to_display_point(&position_map.snapshot),
);

if transitioned {
self.request_autoscroll(Autoscroll::fit(), cx);
self.update_visible_inline_completion(window, cx);
cx.notify();
}
} else if self.edit_prediction_preview.end(
self.selections
Expand Down

0 comments on commit 14d9788

Please sign in to comment.