Description
Tab completions are wrong when the command line text matches a command name or alias. With a cli with a lot commands/aliases this makes tab completion painful because you might hit an alias and then it doesn't go through other commands.
CompletionAction runs this parse:
var completionParseResult = parseResult.RootCommandResult.Command.Parse(commandLineToComplete, parseResult.Configuration);
If it matches a command or alias, the completionParseResult is set to that command and GetCompletions is run jsut for that specific command.
Example below. When running [suggest:1] "t" I would expect it to show me "test-log-levels" and "test-log-colors" but it is just showing "--option1" which is also weird considering if it was the full completions for "t" it would be the following (what it displays with [suggest:2] "t")
--help
--option1
-?
-h
-o1
/?
/h
void Main()
{
CliRootCommand cliRootCommand = new CliRootCommand();
CliCommand command = new CliCommand("test-log-levels", "Show use of the different log levels by printing a log message at each level");
command.Aliases.Add("t");
command.Options.Add(new CliOption<bool>("--option1", "-o1"));
CliCommand command2 = new CliCommand("test-log-colors", "Show use of the different log levels by printing a log message at each level");
cliRootCommand.Subcommands.Add(command);
cliRootCommand.Subcommands.Add(command2);
string[] args = new string[] { "[suggest:1]", "t"};
var cliConfiguration = new CliConfiguration(cliRootCommand) { };
var parseResult = cliConfiguration.Parse(args);
int exitCode = parseResult.InvokeAsync().Result;
}
Planning to look into this a bit more, initial thoughts is the parsing for suggest should be different, "t" with position 1 it shouldn't just parse to the specific command, "t" position 2 should though since there is a space after.