assistant2: Suggest current thread in inline assistant (#22586)

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.com>
This commit is contained in:
Agus Zubiaga 2025-01-02 17:36:57 -03:00 committed by GitHub
parent 0e75ca8603
commit 374c298bd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 161 additions and 114 deletions

View file

@ -4,6 +4,8 @@ use project::ProjectEntryId;
use serde::{Deserialize, Serialize};
use util::post_inc;
use crate::thread::ThreadId;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Serialize, Deserialize)]
pub struct ContextId(pub(crate) usize);
@ -22,12 +24,12 @@ pub struct Context {
pub text: SharedString,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ContextKind {
File(ProjectEntryId),
Directory,
FetchedUrl,
Thread,
Thread(ThreadId),
}
pub fn attach_context_to_message(
@ -55,7 +57,7 @@ pub fn attach_context_to_message(
fetch_context.push_str(&context.text);
fetch_context.push('\n');
}
ContextKind::Thread => {
ContextKind::Thread(_) => {
thread_context.push_str(&context.name);
thread_context.push('\n');
thread_context.push_str(&context.text);