Rework edit prediction preview mode (#24700)

Don't animate the cursor when previewing jumps.
Instead, display the jump popover with a line that resembles a cursor,
indicating the jump destination. If the jump destination is outside of
the view port, there is an extra step in which `tab` scrolls the
viewport to reveal the jump destination.

Release Notes:

- N/A

---------

Co-authored-by: danilo-leal <daniloleal09@gmail.com>
Co-authored-by: agu-z <hi@aguz.me>
This commit is contained in:
Max Brunsfeld 2025-02-11 15:14:12 -08:00 committed by GitHub
parent 5293f5724c
commit 148547ecd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 245 additions and 519 deletions

View file

@ -145,29 +145,6 @@ impl Editor {
target_top = newest_selection_top;
target_bottom = newest_selection_top + 1.;
}
if self.edit_prediction_preview.is_active() {
if let Some(completion) = self.active_inline_completion.as_ref() {
match completion.completion {
crate::InlineCompletion::Edit { .. } => {}
crate::InlineCompletion::Move { target, .. } => {
let target_row = target.to_display_point(&display_map).row().as_f32();
if target_row < target_top {
target_top = target_row;
} else if target_row >= target_bottom {
target_bottom = target_row + 1.;
}
let selections_fit = target_bottom - target_top <= visible_lines;
if !selections_fit {
target_top = target_row;
target_bottom = target_row + 1.;
}
}
}
}
}
}
let margin = if matches!(self.mode, EditorMode::AutoHeight { .. }) {