assistant2: Make ContextStore::insert_*
methods private (#22989)
This PR makes the `insert_*` methods on the `ContextStore` private, to reduce confusion with the public `add_*` methods. Release Notes: - N/A
This commit is contained in:
parent
1fcc9b36ba
commit
40ecc38dd2
3 changed files with 38 additions and 35 deletions
|
@ -1,12 +1,10 @@
|
|||
use std::rc::Rc;
|
||||
|
||||
use anyhow::Result;
|
||||
use collections::HashSet;
|
||||
use editor::Editor;
|
||||
use file_icons::FileIcons;
|
||||
use gpui::{
|
||||
DismissEvent, EventEmitter, FocusHandle, Model, ModelContext, Subscription, Task, View,
|
||||
WeakModel, WeakView,
|
||||
DismissEvent, EventEmitter, FocusHandle, Model, Subscription, View, WeakModel, WeakView,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::Buffer;
|
||||
|
@ -244,7 +242,7 @@ impl Render for ContextStrip {
|
|||
let context_store = self.context_store.clone();
|
||||
Rc::new(cx.listener(move |this, _event, cx| {
|
||||
let task = context_store.update(cx, |context_store, cx| {
|
||||
suggested.accept(context_store, cx)
|
||||
context_store.accept_suggested_context(&suggested, cx)
|
||||
});
|
||||
|
||||
let workspace = this.workspace.clone();
|
||||
|
@ -339,30 +337,6 @@ impl SuggestedContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn accept(
|
||||
&self,
|
||||
context_store: &mut ContextStore,
|
||||
cx: &mut ModelContext<ContextStore>,
|
||||
) -> Task<Result<()>> {
|
||||
match self {
|
||||
Self::File {
|
||||
buffer,
|
||||
icon_path: _,
|
||||
name: _,
|
||||
} => {
|
||||
if let Some(buffer) = buffer.upgrade() {
|
||||
return context_store.add_file_from_buffer(buffer, cx);
|
||||
};
|
||||
}
|
||||
Self::Thread { thread, name: _ } => {
|
||||
if let Some(thread) = thread.upgrade() {
|
||||
context_store.insert_thread(thread, cx);
|
||||
};
|
||||
}
|
||||
}
|
||||
Task::ready(Ok(()))
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> ContextKind {
|
||||
match self {
|
||||
Self::File { .. } => ContextKind::File,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue