Immediate edit step resolution (#16447)

## Todo

* [x] Parse and present new XML output
* [x] Resolve new edits to buffers and anchor ranges
* [x] Surface resolution errors
* [x] Steps fail to resolve because language hasn't loaded yet
* [x] Treat empty `<symbol>` tag as None
* [x] duplicate assists when editing steps
* [x] step footer blocks can appear *below* the following message header
block

## Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Peter <peter@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Max Brunsfeld 2024-08-29 10:18:52 -07:00 committed by GitHub
parent fc4c533d0a
commit f84ef5e48a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 2737 additions and 2336 deletions

View file

@ -21,7 +21,7 @@ use async_watch as watch;
pub use clock::ReplicaId;
use futures::channel::oneshot;
use gpui::{
AnyElement, AppContext, EventEmitter, HighlightStyle, ModelContext, Task, TaskLabel,
AnyElement, AppContext, EventEmitter, HighlightStyle, ModelContext, Pixels, Task, TaskLabel,
WindowContext,
};
use lsp::LanguageServerId;
@ -40,7 +40,7 @@ use std::{
future::Future,
iter::{self, Iterator, Peekable},
mem,
ops::{Deref, Range},
ops::{Deref, DerefMut, Range},
path::{Path, PathBuf},
str,
sync::{Arc, LazyLock},
@ -486,11 +486,16 @@ pub struct Chunk<'a> {
#[derive(Clone)]
pub struct ChunkRenderer {
/// creates a custom element to represent this chunk.
pub render: Arc<dyn Send + Sync + Fn(&mut WindowContext) -> AnyElement>,
pub render: Arc<dyn Send + Sync + Fn(&mut ChunkRendererContext) -> AnyElement>,
/// If true, the element is constrained to the shaped width of the text.
pub constrain_width: bool,
}
pub struct ChunkRendererContext<'a, 'b> {
pub context: &'a mut WindowContext<'b>,
pub max_width: Pixels,
}
impl fmt::Debug for ChunkRenderer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("ChunkRenderer")
@ -499,6 +504,20 @@ impl fmt::Debug for ChunkRenderer {
}
}
impl<'a, 'b> Deref for ChunkRendererContext<'a, 'b> {
type Target = WindowContext<'b>;
fn deref(&self) -> &Self::Target {
self.context
}
}
impl<'a, 'b> DerefMut for ChunkRendererContext<'a, 'b> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.context
}
}
/// A set of edits to a given version of a buffer, computed asynchronously.
#[derive(Debug)]
pub struct Diff {