Complete named settings for TUI slash commands (#63036)

## Why

Slash-command completion only suggested positional arguments, leaving users
to recall named flags and their accepted values.

## What changed

Suggest flags for `/model`, `/permissions`, `/title`, `/statusline`, and
`/mcp login` using the same flag definitions as command parsing. Tab
completes known values in both `--name=value` and `--name value` forms.
For example, `/model --speed=f` completes to `/model --speed=flex`.

Named completion also works in multiline drafts and filters out flags
already present in the command.

## Testing

Add composer tests for both value forms, multiline completion, duplicate
flags, and quoted arguments, plus a snapshot of the `/model` flag popup.

GitOrigin-RevId: f874f67c4601012252775e811ddf496dbc6c4817
This commit is contained in:
Benjamin Carlsson
2026-11-21 20:41:19 +00:00
committed by copyberry
parent 140815f19c
commit 59edd0d512
12 changed files with 363 additions and 63 deletions
+2 -1
View File
@@ -23,7 +23,8 @@ struct ModelCommand {
}
fn parse_model_command_args(args: &str) -> Result<ModelCommandArgs, String> {
let parsed = slash_command_args::parse(args, &["--reasoning", "--speed"], &[], &[])?;
let parsed =
slash_command_args::parse_settings(args, crate::slash_command::SlashCommand::Model)?;
if let Some(unexpected) = parsed.positionals.get(1) {
return Err(format!(
"Unexpected argument '{unexpected}'. Use '--reasoning=<level>' or '--speed=<tier>'."