Draw gutter highlights and indicators on top of blocks (#13142)

This ensures that the gutter progress in the inline assistant is
contiguous.

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2024-06-17 15:34:05 +02:00 committed by GitHub
parent 78091fa91e
commit 6322351f00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 73 additions and 64 deletions

View file

@ -335,24 +335,32 @@ impl InlineAssistant {
let buffer = editor.read(cx).buffer().read(cx).snapshot(cx);
let assist_range = assist.codegen.read(cx).range().to_offset(&buffer);
let editor = editor.read(cx);
if let Some(decorations) = assist.editor_decorations.as_ref() {
if editor.selections.count() == 1 {
let selection = editor.selections.newest::<usize>(cx);
if assist_range.contains(&selection.start) && assist_range.contains(&selection.end)
{
decorations.prompt_editor.update(cx, |prompt_editor, cx| {
prompt_editor.editor.update(cx, |editor, cx| {
editor.select_all(&SelectAll, cx);
editor.focus(cx);
let propagate = editor.update(cx, |editor, cx| {
if let Some(decorations) = assist.editor_decorations.as_ref() {
if editor.selections.count() == 1 {
let selection = editor.selections.newest::<usize>(cx);
if assist_range.contains(&selection.start)
&& assist_range.contains(&selection.end)
{
editor.change_selections(Some(Autoscroll::newest()), cx, |selections| {
selections.select_ranges([assist_range.start..assist_range.start]);
});
});
return;
decorations.prompt_editor.update(cx, |prompt_editor, cx| {
prompt_editor.editor.update(cx, |prompt_editor, cx| {
prompt_editor.select_all(&SelectAll, cx);
prompt_editor.focus(cx);
});
});
return false;
}
}
}
}
true
});
cx.propagate();
if propagate {
cx.propagate();
}
}
fn handle_editor_event(