Allow prompt templates to be overridden in the zed configuration directory (#15887)

I need this to refine our prompts on the fly as I work.

Release Notes:

- Templates for prompts driving inline transformation in editors and the
terminal can now be overridden in the `~/.config/zed/prompts/templates`
directory. This is an advanced feature, and prevents you from getting
upstream changes. It's intended for use by Zed developers.
This commit is contained in:
Nathan Sobo 2024-08-06 19:30:48 -06:00 committed by GitHub
parent 6065db174a
commit c8f1358629
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 569 additions and 168 deletions

View file

@ -35,6 +35,7 @@ use slash_command::{
};
use std::sync::Arc;
pub(crate) use streaming_diff::*;
use util::ResultExt;
actions!(
assistant,
@ -197,8 +198,17 @@ pub fn init(fs: Arc<dyn Fs>, client: Arc<Client>, cx: &mut AppContext) {
assistant_slash_command::init(cx);
register_slash_commands(cx);
assistant_panel::init(cx);
inline_assistant::init(fs.clone(), client.telemetry().clone(), cx);
terminal_inline_assistant::init(fs.clone(), client.telemetry().clone(), cx);
if let Some(prompt_builder) = prompts::PromptBuilder::new(Some((fs.clone(), cx))).log_err() {
let prompt_builder = Arc::new(prompt_builder);
inline_assistant::init(
fs.clone(),
prompt_builder.clone(),
client.telemetry().clone(),
cx,
);
terminal_inline_assistant::init(fs.clone(), prompt_builder, client.telemetry().clone(), cx);
}
IndexedDocsRegistry::init_global(cx);
CommandPaletteFilter::update_global(cx, |filter, _cx| {