agent: Add new panel navigation dropdown (#29539)
- [x] Ensure what appears in the dropdown is really what is accurate - [x] Ensure keyboard navigation works: - [x] Switching tabs with `enter` - [x] Closing items from the menu item - [x] Opening the dropdown - [x] Focus assistant panel on dismiss - [x] Add ability to close items from the dropdown menu - [x] Persistence - [x] Correct behavior when opening a text thread Release Notes: - agent: Added a navigation menu that shows the recently opened threads. The button to see the full history view has been changed inside this menu. --------- Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de> Co-authored-by: Cole Miller <m@cole-miller.net> Co-authored-by: Bennet Bo Fenner <bennet@zed.dev> Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
parent
1a4d7249f6
commit
b1395c5fdf
17 changed files with 740 additions and 229 deletions
|
@ -35,7 +35,7 @@ use std::{
|
|||
fmt::Debug,
|
||||
iter, mem,
|
||||
ops::Range,
|
||||
path::{Path, PathBuf},
|
||||
path::Path,
|
||||
str::FromStr as _,
|
||||
sync::Arc,
|
||||
time::{Duration, Instant},
|
||||
|
@ -46,7 +46,7 @@ use ui::IconName;
|
|||
use util::{ResultExt, TryFutureExt, post_inc};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
pub struct ContextId(String);
|
||||
|
||||
impl ContextId {
|
||||
|
@ -648,7 +648,7 @@ pub struct AssistantContext {
|
|||
pending_token_count: Task<Option<()>>,
|
||||
pending_save: Task<Result<()>>,
|
||||
pending_cache_warming_task: Task<Option<()>>,
|
||||
path: Option<PathBuf>,
|
||||
path: Option<Arc<Path>>,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
telemetry: Option<Arc<Telemetry>>,
|
||||
language_registry: Arc<LanguageRegistry>,
|
||||
|
@ -839,7 +839,7 @@ impl AssistantContext {
|
|||
|
||||
pub fn deserialize(
|
||||
saved_context: SavedContext,
|
||||
path: PathBuf,
|
||||
path: Arc<Path>,
|
||||
language_registry: Arc<LanguageRegistry>,
|
||||
prompt_builder: Arc<PromptBuilder>,
|
||||
slash_commands: Arc<SlashCommandWorkingSet>,
|
||||
|
@ -1147,8 +1147,8 @@ impl AssistantContext {
|
|||
self.prompt_builder.clone()
|
||||
}
|
||||
|
||||
pub fn path(&self) -> Option<&Path> {
|
||||
self.path.as_deref()
|
||||
pub fn path(&self) -> Option<&Arc<Path>> {
|
||||
self.path.as_ref()
|
||||
}
|
||||
|
||||
pub fn summary(&self) -> Option<&ContextSummary> {
|
||||
|
@ -3181,7 +3181,7 @@ impl AssistantContext {
|
|||
fs.atomic_write(new_path.clone(), serde_json::to_string(&context).unwrap())
|
||||
.await?;
|
||||
if let Some(old_path) = old_path {
|
||||
if new_path != old_path {
|
||||
if new_path.as_path() != old_path.as_ref() {
|
||||
fs.remove_file(
|
||||
&old_path,
|
||||
RemoveOptions {
|
||||
|
@ -3193,7 +3193,7 @@ impl AssistantContext {
|
|||
}
|
||||
}
|
||||
|
||||
this.update(cx, |this, _| this.path = Some(new_path))?;
|
||||
this.update(cx, |this, _| this.path = Some(new_path.into()))?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -3589,6 +3589,6 @@ impl SavedContextV0_1_0 {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct SavedContextMetadata {
|
||||
pub title: String,
|
||||
pub path: PathBuf,
|
||||
pub path: Arc<Path>,
|
||||
pub mtime: chrono::DateTime<chrono::Local>,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue