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:
parent
88a12b60a9
commit
8fe2de1737
23 changed files with 332 additions and 263 deletions
|
@ -154,7 +154,7 @@ impl zed::Extension for GleamExtension {
|
|||
fn complete_slash_command_argument(
|
||||
&self,
|
||||
command: SlashCommand,
|
||||
_query: String,
|
||||
_arguments: Vec<String>,
|
||||
) -> Result<Vec<SlashCommandArgumentCompletion>, String> {
|
||||
match command.name.as_str() {
|
||||
"gleam-project" => Ok(vec![
|
||||
|
@ -181,12 +181,12 @@ impl zed::Extension for GleamExtension {
|
|||
fn run_slash_command(
|
||||
&self,
|
||||
command: SlashCommand,
|
||||
argument: Option<String>,
|
||||
args: Vec<String>,
|
||||
worktree: Option<&zed::Worktree>,
|
||||
) -> Result<SlashCommandOutput, String> {
|
||||
match command.name.as_str() {
|
||||
"gleam-docs" => {
|
||||
let argument = argument.ok_or_else(|| "missing argument".to_string())?;
|
||||
let argument = args.last().ok_or_else(|| "missing argument".to_string())?;
|
||||
|
||||
let mut components = argument.split('/');
|
||||
let package_name = components
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue