Restructure assistant edits to show all changes in a proposed-change editor (#18240)
This changes the `/workflow` command so that instead of emitting edits in separate steps, the user is presented with a single tab, with an editable diff that they can apply to the buffer. Todo * Assistant panel * [x] Show a patch title and a list of changed files in a block decoration * [x] Don't store resolved patches as state on Context. Resolve on demand. * [ ] Better presentation of patches in the panel * [ ] Show a spinner while patch is streaming in * Patches * [x] Preserve leading whitespace in new text, auto-indent insertions * [x] Ensure patch title is very short, to fit better in tab * [x] Improve patch location resolution, prefer skipping whitespace over skipping `}` * [x] Ensure patch edits are auto-indented properly * [ ] Apply `Update` edits via a diff between the old and new text, to get fine-grained edits. * Proposed changes editor * [x] Show patch title in the tab * [x] Add a toolbar with an "Apply all" button * [x] Make `open excerpts` open the corresponding location in the base buffer (https://github.com/zed-industries/zed/pull/18591) * [x] Add an apply button above every hunk (https://github.com/zed-industries/zed/pull/18592) * [x] Expand all diff hunks by default (https://github.com/zed-industries/zed/pull/18598) * [x] Fix https://github.com/zed-industries/zed/issues/18589 * [x] Syntax highlighting doesn't work until the buffer is edited (https://github.com/zed-industries/zed/pull/18648) * [x] Disable LSP interaction in Proposed Changes editor (https://github.com/zed-industries/zed/pull/18945) * [x] No auto-indent? (https://github.com/zed-industries/zed/pull/18984) * Prompt * [ ] make sure old_text is unique Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com> Co-authored-by: Antonio <antonio@zed.dev> Co-authored-by: Richard <richard@zed.dev> Co-authored-by: Marshall <marshall@zed.dev> Co-authored-by: Nate Butler <iamnbutler@gmail.com> Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Richard Feldman <oss@rtfeldman.com>
This commit is contained in:
parent
4ae2f93086
commit
411f64b374
22 changed files with 1699 additions and 2816 deletions
|
@ -6,6 +6,7 @@ mod context;
|
|||
pub mod context_store;
|
||||
mod inline_assistant;
|
||||
mod model_selector;
|
||||
mod patch;
|
||||
mod prompt_library;
|
||||
mod prompts;
|
||||
mod slash_command;
|
||||
|
@ -14,7 +15,6 @@ pub mod slash_command_settings;
|
|||
mod streaming_diff;
|
||||
mod terminal_inline_assistant;
|
||||
mod tools;
|
||||
mod workflow;
|
||||
|
||||
pub use assistant_panel::{AssistantPanel, AssistantPanelEvent};
|
||||
use assistant_settings::AssistantSettings;
|
||||
|
@ -35,11 +35,13 @@ use language_model::{
|
|||
LanguageModelId, LanguageModelProviderId, LanguageModelRegistry, LanguageModelResponseMessage,
|
||||
};
|
||||
pub(crate) use model_selector::*;
|
||||
pub use patch::*;
|
||||
pub use prompts::PromptBuilder;
|
||||
use prompts::PromptLoadingParams;
|
||||
use semantic_index::{CloudEmbeddingProvider, SemanticDb};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use settings::{update_settings_file, Settings, SettingsStore};
|
||||
use slash_command::workflow_command::WorkflowSlashCommand;
|
||||
use slash_command::{
|
||||
auto_command, cargo_workspace_command, context_server_command, default_command, delta_command,
|
||||
diagnostics_command, docs_command, fetch_command, file_command, now_command, project_command,
|
||||
|
@ -50,7 +52,6 @@ use std::path::PathBuf;
|
|||
use std::sync::Arc;
|
||||
pub(crate) use streaming_diff::*;
|
||||
use util::ResultExt;
|
||||
pub use workflow::*;
|
||||
|
||||
use crate::slash_command_settings::SlashCommandSettings;
|
||||
|
||||
|
@ -393,12 +394,25 @@ fn register_slash_commands(prompt_builder: Option<Arc<PromptBuilder>>, cx: &mut
|
|||
slash_command_registry.register_command(now_command::NowSlashCommand, false);
|
||||
slash_command_registry.register_command(diagnostics_command::DiagnosticsSlashCommand, true);
|
||||
slash_command_registry.register_command(fetch_command::FetchSlashCommand, false);
|
||||
slash_command_registry.register_command(fetch_command::FetchSlashCommand, false);
|
||||
|
||||
if let Some(prompt_builder) = prompt_builder {
|
||||
slash_command_registry.register_command(
|
||||
workflow_command::WorkflowSlashCommand::new(prompt_builder.clone()),
|
||||
true,
|
||||
);
|
||||
cx.observe_global::<SettingsStore>({
|
||||
let slash_command_registry = slash_command_registry.clone();
|
||||
let prompt_builder = prompt_builder.clone();
|
||||
move |cx| {
|
||||
if AssistantSettings::get_global(cx).are_live_diffs_enabled(cx) {
|
||||
slash_command_registry.register_command(
|
||||
workflow_command::WorkflowSlashCommand::new(prompt_builder.clone()),
|
||||
true,
|
||||
);
|
||||
} else {
|
||||
slash_command_registry.unregister_command_by_name(WorkflowSlashCommand::NAME);
|
||||
}
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
||||
cx.observe_flag::<project_command::ProjectSlashCommandFeatureFlag, _>({
|
||||
let slash_command_registry = slash_command_registry.clone();
|
||||
move |is_enabled, _cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue