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:
Marshall Bowers 2024-06-18 17:58:57 -04:00 committed by GitHub
parent ad4e52842c
commit db0d843fb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 90 additions and 19 deletions

View file

@ -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>>> {

View file

@ -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>>,

View file

@ -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>>,

View file

@ -113,7 +113,7 @@ impl SlashCommand for FetchSlashCommand {
}
fn complete_argument(
&self,
self: Arc<Self>,
_query: String,
_cancel: Arc<AtomicBool>,
_workspace: Option<WeakView<Workspace>>,

View file

@ -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>>,

View file

@ -29,7 +29,7 @@ impl SlashCommand for NowSlashCommand {
}
fn complete_argument(
&self,
self: Arc<Self>,
_query: String,
_cancel: Arc<AtomicBool>,
_workspace: Option<WeakView<Workspace>>,

View file

@ -102,7 +102,7 @@ impl SlashCommand for ProjectSlashCommand {
}
fn complete_argument(
&self,
self: Arc<Self>,
_query: String,
_cancel: Arc<AtomicBool>,
_workspace: Option<WeakView<Workspace>>,

View file

@ -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>>,

View file

@ -107,7 +107,7 @@ impl SlashCommand for RustdocSlashCommand {
}
fn complete_argument(
&self,
self: Arc<Self>,
query: String,
_cancel: Arc<AtomicBool>,
workspace: Option<WeakView<Workspace>>,

View file

@ -47,7 +47,7 @@ impl SlashCommand for SearchSlashCommand {
}
fn complete_argument(
&self,
self: Arc<Self>,
_query: String,
_cancel: Arc<AtomicBool>,
_workspace: Option<WeakView<Workspace>>,

View file

@ -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>>,