From 21137d2ba7439b8045b664607459d822727e5121 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 29 Oct 2024 13:57:33 -0400 Subject: [PATCH] Delete /workflow (#19900) This a separate PR from https://github.com/zed-industries/zed/pull/19705 so we can revert it more easily if we want it back later. Release Notes: - Added "Suggest Edit" button to the assistant panel if `"enable_experimental_live_diffs": true` is set in the `"assistant"` section of `settings.json`. This button takes the place of the previous `/workflow` command, but it is experimental and may change! --------- Co-authored-by: Nathan Sobo Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> --- crates/assistant/src/assistant.rs | 18 ---- crates/assistant/src/slash_command.rs | 1 - .../src/slash_command/workflow_command.rs | 82 ------------------- 3 files changed, 101 deletions(-) delete mode 100644 crates/assistant/src/slash_command/workflow_command.rs diff --git a/crates/assistant/src/assistant.rs b/crates/assistant/src/assistant.rs index c96358ae99..c2857d06d4 100644 --- a/crates/assistant/src/assistant.rs +++ b/crates/assistant/src/assistant.rs @@ -41,12 +41,10 @@ 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, prompt_command, search_command, symbols_command, tab_command, terminal_command, - workflow_command, }; use std::path::PathBuf; use std::sync::Arc; @@ -445,22 +443,6 @@ fn register_slash_commands(prompt_builder: Option>, cx: &mut slash_command_registry.register_command(fetch_command::FetchSlashCommand, false); if let Some(prompt_builder) = prompt_builder { - cx.observe_global::({ - 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::({ let slash_command_registry = slash_command_registry.clone(); move |is_enabled, _cx| { diff --git a/crates/assistant/src/slash_command.rs b/crates/assistant/src/slash_command.rs index e430e35622..ed20791d95 100644 --- a/crates/assistant/src/slash_command.rs +++ b/crates/assistant/src/slash_command.rs @@ -34,7 +34,6 @@ pub mod search_command; pub mod symbols_command; pub mod tab_command; pub mod terminal_command; -pub mod workflow_command; pub(crate) struct SlashCommandCompletionProvider { cancel_flag: Mutex>, diff --git a/crates/assistant/src/slash_command/workflow_command.rs b/crates/assistant/src/slash_command/workflow_command.rs deleted file mode 100644 index ca6ccde92e..0000000000 --- a/crates/assistant/src/slash_command/workflow_command.rs +++ /dev/null @@ -1,82 +0,0 @@ -use std::sync::atomic::AtomicBool; -use std::sync::Arc; - -use anyhow::Result; -use assistant_slash_command::{ - ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, - SlashCommandResult, -}; -use gpui::{Task, WeakView}; -use language::{BufferSnapshot, LspAdapterDelegate}; -use ui::prelude::*; -use workspace::Workspace; - -use crate::prompts::PromptBuilder; - -pub(crate) struct WorkflowSlashCommand { - prompt_builder: Arc, -} - -impl WorkflowSlashCommand { - pub const NAME: &'static str = "workflow"; - - pub fn new(prompt_builder: Arc) -> Self { - Self { prompt_builder } - } -} - -impl SlashCommand for WorkflowSlashCommand { - fn name(&self) -> String { - Self::NAME.into() - } - - fn description(&self) -> String { - "Insert prompt to opt into the edit workflow".into() - } - - fn menu_text(&self) -> String { - self.description() - } - - fn requires_argument(&self) -> bool { - false - } - - fn complete_argument( - self: Arc, - _arguments: &[String], - _cancel: Arc, - _workspace: Option>, - _cx: &mut WindowContext, - ) -> Task>> { - Task::ready(Ok(Vec::new())) - } - - fn run( - self: Arc, - _arguments: &[String], - _context_slash_command_output_sections: &[SlashCommandOutputSection], - _context_buffer: BufferSnapshot, - _workspace: WeakView, - _delegate: Option>, - cx: &mut WindowContext, - ) -> Task { - let prompt_builder = self.prompt_builder.clone(); - cx.spawn(|_cx| async move { - let text = prompt_builder.generate_workflow_prompt()?; - let range = 0..text.len(); - - Ok(SlashCommandOutput { - text, - sections: vec![SlashCommandOutputSection { - range, - icon: IconName::Route, - label: "Workflow".into(), - metadata: None, - }], - run_commands_in_text: false, - } - .to_event_stream()) - }) - } -}