assistant2: Push logic for adding thread context down into the ContextStore
(#22855)
This PR takes the logic for adding thread context out of the `ThreadContextPicker` and pushes it down into the `ContextStore`. Release Notes: - N/A
This commit is contained in:
parent
b78396505f
commit
7e39023ea5
2 changed files with 12 additions and 10 deletions
|
@ -4,7 +4,7 @@ use std::sync::Arc;
|
|||
|
||||
use anyhow::{anyhow, bail, Result};
|
||||
use collections::{HashMap, HashSet};
|
||||
use gpui::{ModelContext, SharedString, Task, WeakView};
|
||||
use gpui::{Model, ModelContext, SharedString, Task, WeakView};
|
||||
use language::Buffer;
|
||||
use project::{ProjectPath, Worktree};
|
||||
use workspace::Workspace;
|
||||
|
@ -229,6 +229,14 @@ impl ContextStore {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn add_thread(&mut self, thread: Model<Thread>, cx: &mut ModelContext<Self>) {
|
||||
if let Some(context_id) = self.included_thread(&thread.read(cx).id()) {
|
||||
self.remove_context(&context_id);
|
||||
} else {
|
||||
self.insert_thread(thread.read(cx));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert_thread(&mut self, thread: &Thread) {
|
||||
let context_id = self.next_context_id.post_inc();
|
||||
self.threads.insert(thread.id().clone(), context_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue