Fix double lease panic in Quote Selection command (#12217)
Release Notes: - Fixed a panic that occurred when using the `assistant: quote selection` command while signed out.
This commit is contained in:
parent
9c35187aac
commit
e15b902974
2 changed files with 31 additions and 49 deletions
|
@ -3271,52 +3271,26 @@ impl ConversationEditor {
|
|||
}
|
||||
|
||||
if let Some(text) = text {
|
||||
panel.update(cx, |panel, cx| {
|
||||
if let Some(conversation) = panel
|
||||
.active_conversation_editor()
|
||||
.cloned()
|
||||
.or_else(|| panel.new_conversation(cx))
|
||||
{
|
||||
conversation.update(cx, |conversation, cx| {
|
||||
conversation
|
||||
.editor
|
||||
.update(cx, |editor, cx| editor.insert(&text, cx))
|
||||
});
|
||||
};
|
||||
panel.update(cx, |_, cx| {
|
||||
// Wait to create a new conversation until the workspace is no longer
|
||||
// being updated.
|
||||
cx.defer(move |panel, cx| {
|
||||
if let Some(conversation) = panel
|
||||
.active_conversation_editor()
|
||||
.cloned()
|
||||
.or_else(|| panel.new_conversation(cx))
|
||||
{
|
||||
conversation.update(cx, |conversation, cx| {
|
||||
conversation
|
||||
.editor
|
||||
.update(cx, |editor, cx| editor.insert(&text, cx))
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// fn insert_active_prompt(
|
||||
// workspace: &mut Workspace,
|
||||
// _: &InsertActivePrompt,
|
||||
// cx: &mut ViewContext<Workspace>,
|
||||
// ) {
|
||||
// let Some(panel) = workspace.panel::<AssistantPanel>(cx) else {
|
||||
// return;
|
||||
// };
|
||||
|
||||
// if !panel.focus_handle(cx).contains_focused(cx) {
|
||||
// workspace.toggle_panel_focus::<AssistantPanel>(cx);
|
||||
// }
|
||||
|
||||
// if let Some(default_prompt) = panel.read(cx).prompt_library.clone().default_prompt() {
|
||||
// panel.update(cx, |panel, cx| {
|
||||
// if let Some(conversation) = panel
|
||||
// .active_conversation_editor()
|
||||
// .cloned()
|
||||
// .or_else(|| panel.new_conversation(cx))
|
||||
// {
|
||||
// conversation.update(cx, |conversation, cx| {
|
||||
// conversation
|
||||
// .editor
|
||||
// .update(cx, |editor, cx| editor.insert(&default_prompt, cx))
|
||||
// });
|
||||
// };
|
||||
// });
|
||||
// };
|
||||
// }
|
||||
|
||||
fn copy(&mut self, _: &editor::actions::Copy, cx: &mut ViewContext<Self>) {
|
||||
let editor = self.editor.read(cx);
|
||||
let conversation = self.conversation.read(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue