-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Console] [WIP] Handle case where user tries to complete more arguments than there are available #47726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Does this work fine for commands accepting array arguments, where the number of accepted arguments is infinite ? |
df54466
to
b50485a
Compare
based on your comment in #47432 (comment), shouldn't this PR target 5.4 ? |
Yes, the Existing tests should cover all these array argument cases: symfony/src/Symfony/Component/Console/Tests/Completion/CompletionInputTest.php Lines 93 to 98 in 6b56480
🤦♂️ yep |
Note that my PR also targets 5.4, but anyway thanks for the fix here! |
@wouterj but if we are after the last written argument value, we still want completion for a next one in case of an infinite list. That's what I'm unsure about. |
Marking this as WIP, the failing test in FrameworkBundle reveals some errors with this approach (we should only compare argument tokens, not all tokens as this includes options and option values). |
That should be covered by: This data set replicates |
Closing here for now. I haven't looked into this for years, and haven't seen any other community reports about this for the past 2.5 years. It's a complex issue to fix, and for now not worth it imho. |
Imagine a command with 1 argument. If the user tried to complete 2 arguments (e.g.
bin/console some:cmd first sec|
), the current CompletionInput will always suggest new values for the first argument.This PR fixes it by taking a count of the accepted tokens. If there are less tokens accepted then provided, the user is doing something bad (providing too many arguments) and we should stop providing suggestions.
This fix is required for #47432 to work correctly.