Extract ExtensionSlashCommand
to assistant_slash_command
crate (#20617)
This PR extracts the `ExtensionSlashCommand` implementation to the `assistant_slash_command` crate. The slash command related methods have been added to the `Extension` trait. We also create separate data types for the slash command data within the `extension` crate so that we can talk about them without depending on the `extension_host` or `assistant_slash_command`. Release Notes: - N/A
This commit is contained in:
parent
b913cf2e02
commit
254ce74036
12 changed files with 309 additions and 161 deletions
|
@ -1,5 +1,6 @@
|
|||
pub mod extension_builder;
|
||||
mod extension_manifest;
|
||||
mod slash_command;
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
|
@ -10,6 +11,7 @@ use gpui::Task;
|
|||
use semantic_version::SemanticVersion;
|
||||
|
||||
pub use crate::extension_manifest::*;
|
||||
pub use crate::slash_command::*;
|
||||
|
||||
#[async_trait]
|
||||
pub trait WorktreeDelegate: Send + Sync + 'static {
|
||||
|
@ -32,6 +34,19 @@ pub trait Extension: Send + Sync + 'static {
|
|||
/// Returns the path to this extension's working directory.
|
||||
fn work_dir(&self) -> Arc<Path>;
|
||||
|
||||
async fn complete_slash_command_argument(
|
||||
&self,
|
||||
command: SlashCommand,
|
||||
arguments: Vec<String>,
|
||||
) -> Result<Vec<SlashCommandArgumentCompletion>>;
|
||||
|
||||
async fn run_slash_command(
|
||||
&self,
|
||||
command: SlashCommand,
|
||||
arguments: Vec<String>,
|
||||
resource: Option<Arc<dyn WorktreeDelegate>>,
|
||||
) -> Result<SlashCommandOutput>;
|
||||
|
||||
async fn suggest_docs_packages(&self, provider: Arc<str>) -> Result<Vec<String>>;
|
||||
|
||||
async fn index_docs(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue