Further improve /tabs command and slash arguments completion (#16216)

* renames `/tabs` to `/tab`
* allows to insert multiple tabs when fuzzy matching by the names
* improve slash command completion API, introduce a notion of multiple
arguments
* properly fire off commands on arguments' completions with
`run_command: true`

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <marshall@zed.dev>
This commit is contained in:
Kirill Bulatov 2024-08-14 17:11:51 +03:00 committed by GitHub
parent 88a12b60a9
commit 8fe2de1737
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 332 additions and 263 deletions

View file

@ -114,7 +114,7 @@ pub trait Extension: Send + Sync {
fn complete_slash_command_argument(
&self,
_command: SlashCommand,
_query: String,
_args: Vec<String>,
) -> Result<Vec<SlashCommandArgumentCompletion>, String> {
Ok(Vec::new())
}
@ -123,7 +123,7 @@ pub trait Extension: Send + Sync {
fn run_slash_command(
&self,
_command: SlashCommand,
_argument: Option<String>,
_args: Vec<String>,
_worktree: Option<&Worktree>,
) -> Result<SlashCommandOutput, String> {
Err("`run_slash_command` not implemented".to_string())
@ -257,17 +257,17 @@ impl wit::Guest for Component {
fn complete_slash_command_argument(
command: SlashCommand,
query: String,
args: Vec<String>,
) -> Result<Vec<SlashCommandArgumentCompletion>, String> {
extension().complete_slash_command_argument(command, query)
extension().complete_slash_command_argument(command, args)
}
fn run_slash_command(
command: SlashCommand,
argument: Option<String>,
args: Vec<String>,
worktree: Option<&Worktree>,
) -> Result<SlashCommandOutput, String> {
extension().run_slash_command(command, argument, worktree)
extension().run_slash_command(command, args, worktree)
}
fn suggest_docs_packages(provider: String) -> Result<Vec<String>, String> {