Zsh completions are not shown for arguments that are added to a command using an @OptionGroup and that have a custom completion kind.
ArgumentParser version: main
Swift version:
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Checklist
Steps to Reproduce
-
Create a command with an option group with an arguments with a custom completion kind.
import ArgumentParser
struct ArgOptionGroup: ParsableArguments {
@Argument(completion: .custom { _ in
["1-argInOptionGroup", "2-argInOptionGroup", "3-argInOptionGroup"]
})
var argInOptionGroup: String
}
@main
struct CompletionExample: ParsableCommand {
@Argument(completion: .custom { _ in
["1-argInCommand", "2-argInCommand", "3-argInCommand"]
})
var argInCommand: String
@OptionGroup var optionGroup: ArgOptionGroup
}
-
Install the completions in your terminal and load them, steps will vary per environment, for me the steps are.
swift build
- Install the completions.
./completion-example --generate-completion-script zsh > ~/.oh-my-zsh/completions/_completion-example
- Open a new terminal to load the new completions.
-
Type ./completion-example (note the trailing space)

-
Press tab to accept the first completion
-
Press space.

-
Type 1 (the first character of one of the arguments.

Expected behavior
It should suggest completions for the argument from the option group, as it did for the argument in the command (step 3).
Actual behavior
It doesn't show any completions for the arguments in the option group (step 4). When starting to type any of the options that should be suggested (step 5), it prints that there are no matches (probably from zsh-autosuggestions).
Zsh completions are not shown for arguments that are added to a command using an
@OptionGroupand that have acustomcompletion kind.ArgumentParser version:
mainSwift version:
Checklist
mainbranch of this packageSteps to Reproduce
Create a command with an option group with an arguments with a custom completion kind.
Install the completions in your terminal and load them, steps will vary per environment, for me the steps are.
swift buildType

./completion-example(note the trailing space)Press tab to accept the first completion
Press space.

Type

1(the first character of one of the arguments.Expected behavior
It should suggest completions for the argument from the option group, as it did for the argument in the command (step 3).
Actual behavior
It doesn't show any completions for the arguments in the option group (step 4). When starting to type any of the options that should be suggested (step 5), it prints that there are no matches (probably from
zsh-autosuggestions).