Allow saving prompts from the Prompt Manager (#12359)

Adds the following features to the prompt manager:

- New prompt – Create a new prompt from the UI. It will only persist if
it is saved.
- Save prompt – Save a prompt by clicking the save button in the UI. A
keybinding will be added for this in the future.
- Reveal prompt - Show the selected prompt on the file system. Only
available for saved prompts.

New prompts that are saved will use the
`{slugified_title}_{ver}_{id}.md` format which all imported prompts will
move to in the near future.

Also orders prompts in alphabetical order by default.

Release Notes:

- N/A
This commit is contained in:
Nate Butler 2024-05-27 13:48:21 -04:00 committed by GitHub
parent 345361cd38
commit a6dd2ca694
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 476 additions and 89 deletions

View file

@ -1,12 +1,10 @@
use crate::ambient_context::{AmbientContext, ContextUpdated, RecentBuffer};
use crate::prompts::prompt_library::PromptLibrary;
use crate::prompts::prompt_manager::PromptManager;
use crate::prompts::{generate_content_prompt, PromptLibrary, PromptManager};
use crate::{
ambient_context::*,
assistant_settings::{AssistantDockPosition, AssistantSettings, ZedDotDevModel},
codegen::{self, Codegen, CodegenKind},
omit_ranges::text_in_range_omitting_ranges,
prompts::prompt::generate_content_prompt,
search::*,
slash_command::{
current_file_command, file_command, prompt_command, SlashCommandCleanup,
@ -148,7 +146,7 @@ impl AssistantPanel {
.unwrap_or_default();
let prompt_library = Arc::new(
PromptLibrary::load(fs.clone())
PromptLibrary::load_index(fs.clone())
.await
.log_err()
.unwrap_or_default(),