Streaming tools (#11629)

Stream characters in for tool calls to allow rendering partial input.


https://github.com/zed-industries/zed/assets/836375/0f023a4b-9c46-4449-ae69-8b6bcab41673

Release Notes:

- N/A

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Kyle Kelley 2024-05-09 15:57:14 -07:00 committed by GitHub
parent 27ed0f4273
commit 50c45c7897
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 786 additions and 653 deletions

View file

@ -1603,6 +1603,11 @@ impl MultiBuffer {
"untitled".into()
}
pub fn set_title(&mut self, title: String, cx: &mut ModelContext<Self>) {
self.title = Some(title);
cx.notify();
}
#[cfg(any(test, feature = "test-support"))]
pub fn is_parsing(&self, cx: &AppContext) -> bool {
self.as_singleton().unwrap().read(cx).is_parsing()
@ -3151,10 +3156,10 @@ impl MultiBufferSnapshot {
.redacted_ranges(excerpt.range.context.clone())
.map(move |mut redacted_range| {
// Re-base onto the excerpts coordinates in the multibuffer
redacted_range.start =
excerpt_offset + (redacted_range.start - excerpt_buffer_start);
redacted_range.end =
excerpt_offset + (redacted_range.end - excerpt_buffer_start);
redacted_range.start = excerpt_offset
+ redacted_range.start.saturating_sub(excerpt_buffer_start);
redacted_range.end = excerpt_offset
+ redacted_range.end.saturating_sub(excerpt_buffer_start);
redacted_range
})
@ -3179,10 +3184,13 @@ impl MultiBufferSnapshot {
.runnable_ranges(excerpt.range.context.clone())
.map(move |mut runnable| {
// Re-base onto the excerpts coordinates in the multibuffer
runnable.run_range.start =
excerpt_offset + (runnable.run_range.start - excerpt_buffer_start);
runnable.run_range.end =
excerpt_offset + (runnable.run_range.end - excerpt_buffer_start);
runnable.run_range.start = excerpt_offset
+ runnable
.run_range
.start
.saturating_sub(excerpt_buffer_start);
runnable.run_range.end = excerpt_offset
+ runnable.run_range.end.saturating_sub(excerpt_buffer_start);
runnable
})
.skip_while(move |runnable| runnable.run_range.end < range.start)