Skip to content

[rejected AI] Fix completion for attached option values - #3815

Closed
err0r4eve3 wants to merge 1 commit into
pallets:stablefrom
err0r4eve3:fix/attached-option-completion
Closed

[rejected AI] Fix completion for attached option values#3815
err0r4eve3 wants to merge 1 commit into
pallets:stablefrom
err0r4eve3:fix/attached-option-completion

Conversation

@err0r4eve3

Copy link
Copy Markdown

When an incomplete value is joined to a long option with =, _resolve_incomplete strips the option prefix so the parameter can complete only the value. Bash and Zsh replace the entire current word, though, so returning always for --color=al drops the option name.

Preserve the stripped prefix and reattach it to completion items only after the input resolves to an option that accepts a value. Rebuild each item with its original type, help, and custom metadata so custom completion behavior remains intact. Add regression coverage for both an empty and a partial attached value, plus a changelog entry.

Fixes #2847

Tests:

  • uv run pytest
  • uv run mypy
  • uv run pre-commit run --files CHANGES.md src/click/shell_completion.py tests/test_shell_completion.py

@davidism davidism changed the title Fix completion for attached option values [rejected AI] Fix completion for attached option values Aug 31, 2026
@davidism davidism added the rejected AI Contribution rejected because of its untrustworthy AI origin label Aug 31, 2026
@davidism

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected AI Contribution rejected because of its untrustworthy AI origin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants