assistant2: Add prompt editor (#23436)
This PR adds the Assistant1 experience to Assistant2 as a "prompt editor". <img width="1309" alt="Screenshot 2025-01-21 at 7 17 26 PM" src="https://github.com/user-attachments/assets/3ce2f32b-2b1a-48a8-8e56-4c44e3ac4ce5" /> Release Notes: - N/A
This commit is contained in:
parent
3d47f32f0c
commit
e59c910845
9 changed files with 149 additions and 59 deletions
|
@ -5,9 +5,10 @@ use crate::{
|
|||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use assistant_context_editor::{
|
||||
AssistantPanelDelegate, Context, ContextEditor, ContextEditorToolbarItem,
|
||||
ContextEditorToolbarItemEvent, ContextId, ContextStore, ContextStoreEvent, InsertDraggedFiles,
|
||||
SlashCommandCompletionProvider, ToggleModelSelector, DEFAULT_TAB_TITLE,
|
||||
make_lsp_adapter_delegate, AssistantPanelDelegate, Context, ContextEditor,
|
||||
ContextEditorToolbarItem, ContextEditorToolbarItemEvent, ContextId, ContextStore,
|
||||
ContextStoreEvent, InsertDraggedFiles, SlashCommandCompletionProvider, ToggleModelSelector,
|
||||
DEFAULT_TAB_TITLE,
|
||||
};
|
||||
use assistant_settings::{AssistantDockPosition, AssistantSettings};
|
||||
use assistant_slash_command::SlashCommandWorkingSet;
|
||||
|
@ -22,12 +23,11 @@ use gpui::{
|
|||
ParentElement, Pixels, Render, SharedString, StatefulInteractiveElement, Styled, Subscription,
|
||||
Task, UpdateGlobal, View, WeakView,
|
||||
};
|
||||
use language::{LanguageRegistry, LspAdapterDelegate};
|
||||
use language::LanguageRegistry;
|
||||
use language_model::{
|
||||
LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID,
|
||||
};
|
||||
use language_model_selector::LanguageModelSelector;
|
||||
use project::lsp_store::LocalLspAdapterDelegate;
|
||||
use project::Project;
|
||||
use prompt_library::{open_prompt_library, PromptBuilder, PromptLibrary};
|
||||
use search::{buffer_search::DivRegistrar, BufferSearchBar};
|
||||
|
@ -1548,27 +1548,3 @@ impl Item for ConfigurationView {
|
|||
Some("Configuration".into())
|
||||
}
|
||||
}
|
||||
|
||||
fn make_lsp_adapter_delegate(
|
||||
project: &Model<Project>,
|
||||
cx: &mut AppContext,
|
||||
) -> Result<Option<Arc<dyn LspAdapterDelegate>>> {
|
||||
project.update(cx, |project, cx| {
|
||||
// TODO: Find the right worktree.
|
||||
let Some(worktree) = project.worktrees(cx).next() else {
|
||||
return Ok(None::<Arc<dyn LspAdapterDelegate>>);
|
||||
};
|
||||
let http_client = project.client().http_client().clone();
|
||||
project.lsp_store().update(cx, |_, cx| {
|
||||
Ok(Some(LocalLspAdapterDelegate::new(
|
||||
project.languages().clone(),
|
||||
project.environment(),
|
||||
cx.weak_model(),
|
||||
&worktree,
|
||||
http_client,
|
||||
project.fs().clone(),
|
||||
cx,
|
||||
) as Arc<dyn LspAdapterDelegate>))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue