Add the ability to follow the agent as it makes edits (#29839)
Nathan here: I also tacked on a bunch of UI refinement. Release Notes: - Introduced the ability to follow the agent around as it reads and edits files. --------- Co-authored-by: Nathan Sobo <nathan@zed.dev> Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
425f32e068
commit
545ae27079
37 changed files with 1255 additions and 567 deletions
|
@ -19,8 +19,8 @@ pub use crate::{
|
|||
};
|
||||
use anyhow::{Context as _, Result, anyhow};
|
||||
use async_watch as watch;
|
||||
use clock::Lamport;
|
||||
pub use clock::ReplicaId;
|
||||
use clock::{AGENT_REPLICA_ID, Lamport};
|
||||
use collections::HashMap;
|
||||
use fs::MTime;
|
||||
use futures::channel::oneshot;
|
||||
|
@ -2132,6 +2132,31 @@ impl Buffer {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_agent_selections(
|
||||
&mut self,
|
||||
selections: Arc<[Selection<Anchor>]>,
|
||||
line_mode: bool,
|
||||
cursor_shape: CursorShape,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let lamport_timestamp = self.text.lamport_clock.tick();
|
||||
self.remote_selections.insert(
|
||||
AGENT_REPLICA_ID,
|
||||
SelectionSet {
|
||||
selections: selections.clone(),
|
||||
lamport_timestamp,
|
||||
line_mode,
|
||||
cursor_shape,
|
||||
},
|
||||
);
|
||||
self.non_text_state_update_count += 1;
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
pub fn remove_agent_selections(&mut self, cx: &mut Context<Self>) {
|
||||
self.set_agent_selections(Arc::default(), false, Default::default(), cx);
|
||||
}
|
||||
|
||||
/// Replaces the buffer's entire text.
|
||||
pub fn set_text<T>(&mut self, text: T, cx: &mut Context<Self>) -> Option<clock::Lamport>
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue