Allow completing slash command arguments from extensions (#13240)
This PR extends the extension API with support for completing slash command arguments for slash commands defined in extensions. Release Notes: - N/A
This commit is contained in:
parent
ad4e52842c
commit
db0d843fb1
17 changed files with 90 additions and 19 deletions
|
@ -6,6 +6,7 @@ use anyhow::{anyhow, Result};
|
|||
use editor::Editor;
|
||||
use gpui::{AppContext, Task, WeakView};
|
||||
use language::LspAdapterDelegate;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
use ui::WindowContext;
|
||||
use workspace::Workspace;
|
||||
|
@ -26,9 +27,9 @@ impl SlashCommand for ActiveSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
_query: String,
|
||||
_cancel: std::sync::Arc<std::sync::atomic::AtomicBool>,
|
||||
_cancel: Arc<AtomicBool>,
|
||||
_workspace: Option<WeakView<Workspace>>,
|
||||
_cx: &mut AppContext,
|
||||
) -> Task<Result<Vec<String>>> {
|
||||
|
|
|
@ -31,7 +31,7 @@ impl SlashCommand for DefaultSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
_query: String,
|
||||
_cancellation_flag: Arc<AtomicBool>,
|
||||
_workspace: Option<WeakView<Workspace>>,
|
||||
|
|
|
@ -98,7 +98,7 @@ impl SlashCommand for DiagnosticsCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
query: String,
|
||||
cancellation_flag: Arc<AtomicBool>,
|
||||
workspace: Option<WeakView<Workspace>>,
|
||||
|
|
|
@ -113,7 +113,7 @@ impl SlashCommand for FetchSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
_query: String,
|
||||
_cancel: Arc<AtomicBool>,
|
||||
_workspace: Option<WeakView<Workspace>>,
|
||||
|
|
|
@ -101,7 +101,7 @@ impl SlashCommand for FileSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
query: String,
|
||||
cancellation_flag: Arc<AtomicBool>,
|
||||
workspace: Option<WeakView<Workspace>>,
|
||||
|
|
|
@ -29,7 +29,7 @@ impl SlashCommand for NowSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
_query: String,
|
||||
_cancel: Arc<AtomicBool>,
|
||||
_workspace: Option<WeakView<Workspace>>,
|
||||
|
|
|
@ -102,7 +102,7 @@ impl SlashCommand for ProjectSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
_query: String,
|
||||
_cancel: Arc<AtomicBool>,
|
||||
_workspace: Option<WeakView<Workspace>>,
|
||||
|
|
|
@ -28,7 +28,7 @@ impl SlashCommand for PromptSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
query: String,
|
||||
_cancellation_flag: Arc<AtomicBool>,
|
||||
_workspace: Option<WeakView<Workspace>>,
|
||||
|
|
|
@ -107,7 +107,7 @@ impl SlashCommand for RustdocSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
query: String,
|
||||
_cancel: Arc<AtomicBool>,
|
||||
workspace: Option<WeakView<Workspace>>,
|
||||
|
|
|
@ -47,7 +47,7 @@ impl SlashCommand for SearchSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
_query: String,
|
||||
_cancel: Arc<AtomicBool>,
|
||||
_workspace: Option<WeakView<Workspace>>,
|
||||
|
|
|
@ -31,7 +31,7 @@ impl SlashCommand for TabsSlashCommand {
|
|||
}
|
||||
|
||||
fn complete_argument(
|
||||
&self,
|
||||
self: Arc<Self>,
|
||||
_query: String,
|
||||
_cancel: Arc<std::sync::atomic::AtomicBool>,
|
||||
_workspace: Option<WeakView<Workspace>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue