Motivation for this change is to use `ContextStore` in headless assistant, which requires it to not depend on UI entities like `Workspace`. This reapplies a change that was revert was in #28428, and fixes the panic. Release Notes: - N/A
This commit is contained in:
parent
7bf6cd4ccf
commit
9f6c5e2877
6 changed files with 41 additions and 31 deletions
|
@ -227,14 +227,14 @@ impl AssistantPanel {
|
|||
) -> Self {
|
||||
let thread = thread_store.update(cx, |this, cx| this.create_thread(cx));
|
||||
let fs = workspace.app_state().fs.clone();
|
||||
let project = workspace.project().clone();
|
||||
let project = workspace.project();
|
||||
let language_registry = project.read(cx).languages().clone();
|
||||
let workspace = workspace.weak_handle();
|
||||
let weak_self = cx.entity().downgrade();
|
||||
|
||||
let message_editor_context_store = cx.new(|_cx| {
|
||||
crate::context_store::ContextStore::new(
|
||||
workspace.clone(),
|
||||
project.downgrade(),
|
||||
Some(thread_store.downgrade()),
|
||||
)
|
||||
});
|
||||
|
@ -344,7 +344,7 @@ impl AssistantPanel {
|
|||
|
||||
let message_editor_context_store = cx.new(|_cx| {
|
||||
crate::context_store::ContextStore::new(
|
||||
self.workspace.clone(),
|
||||
self.project.downgrade(),
|
||||
Some(self.thread_store.downgrade()),
|
||||
)
|
||||
});
|
||||
|
@ -521,7 +521,7 @@ impl AssistantPanel {
|
|||
this.set_active_view(thread_view, window, cx);
|
||||
let message_editor_context_store = cx.new(|_cx| {
|
||||
crate::context_store::ContextStore::new(
|
||||
this.workspace.clone(),
|
||||
this.project.downgrade(),
|
||||
Some(this.thread_store.downgrade()),
|
||||
)
|
||||
});
|
||||
|
@ -1624,7 +1624,21 @@ impl prompt_library::InlineAssistDelegate for PromptLibraryInlineAssist {
|
|||
cx: &mut Context<PromptLibrary>,
|
||||
) {
|
||||
InlineAssistant::update_global(cx, |assistant, cx| {
|
||||
assistant.assist(&prompt_editor, self.workspace.clone(), None, window, cx)
|
||||
let Some(project) = self
|
||||
.workspace
|
||||
.upgrade()
|
||||
.map(|workspace| workspace.read(cx).project().downgrade())
|
||||
else {
|
||||
return;
|
||||
};
|
||||
assistant.assist(
|
||||
&prompt_editor,
|
||||
self.workspace.clone(),
|
||||
project,
|
||||
None,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue