ConsoleBundle
ConsoleBundle copied to clipboard
Autocomplete: Tab behavior
It would be great that tab stops after the first ":" where different commands are possible.
IE after "doct", tab should stop on "doctrine:"
This is how I implemented it in a really early version but I did not like it because there is already a command selected in the suggestion list so when you press tab I would assume this selected command is used.
When I type "doc" and the first suggestion is "doctrine:cache:clear-metadata" and it is selected (given the behavior you suggest is implemented) I would need to press tab 3 times.
One possibility would be not to focus a suggestion by default and only use your suggested behavior when no suggestion is selected but I assume that would not be very intuitive because there would be more different cases of behavior.
Do you have a concrete case in mind in which the behavior you suggest would be easier to use? I mean when typing "doc" you already see all the doctrine commands. I assume it is about this case:
you want to use the "doctrine:cache:clear-result" command and want to type: "doc"[tab]"ca"[tab]"clear-result" so you save the time writing "trine" and "che".
But the much easier way would be to just write "clear-result" in the beginning as the autocompletion does not force you to start on the left side of the command.
"doctrine:generate:entities" could be a good example. If I wan to use this comand, I would like to be able to type:
- "doc"
- tab
- "ge"
- tab
- "ent"
- tab
One possibility would be not to focus a suggestion by default and only use your suggested behavior when no suggestion is selected but I assume that would not be very intuitive because there would be more different cases of behavior.
:+1: for this. I assume that you would rarely use the first command anyway (especially true when you have a lot of commands, like in the "doctrine" ns).
I think the most "difficult" part of the PR it to avoid unambiguous stops:
- "namespace:sub:abc"
- "namespace:sub:def"
"nam" + tab should autocomplete to "namespace:sub:" as this is not ambiguous.
What should happen wenn I type: "c" tab
I could autocompelete to "cache:" or "config:" or "container:"
Currently the autocompletion list also shows all the doCtrine commands as suggestion too.
Ideally I think you should stop autocompleting where the completion becomes ambiguous (multiple solutions). This would match the behavior of terminals. To continue either select a (sub)command or type more letters.
That's would be the best thing to have imo but something different would be ok if this makes the code too complicated.
Laszlo Korte [email protected] wrote:
What should happen wenn I type: "c" tab
I could autocompelete to "cache:" or "config:" or "container:"
Currently the autocompletion list also shows all the doCtrine commands as suggestion too.
Reply to this email directly or view it on GitHub: https://github.com/CoreSphere/ConsoleBundle/issues/9#issuecomment-13359125
Ok...
I have started implementing this a separate branch: https://github.com/CoreSphere/ConsoleBundle/tree/alternate-autocomp
When the input is ambiguous the old behavior is used: focus first item in autocompletion list
When the input is the prefix of exactly one namespace: no suggestion is focused and pressing tab triggers the autocompletion up to the next ":"
I won't have time to look at it before next friday.
On 02/10/2013 09:37 PM, Laszlo Korte wrote:
Ok...
I have started implementing this a separate branch: https://github.com/CoreSphere/ConsoleBundle/tree/alternate-autocomp
When the input is ambiguous the old behavior is used: focus first item in autocompletion list
When the input is the prefix of exactly one namespace: no suggestion is focused and pressing tab triggers the autocompletion up to the next ":"
— Reply to this email directly or view it on GitHub https://github.com/CoreSphere/ConsoleBundle/issues/9#issuecomment-13360571..
Is this still active? If not, I'd suggesting closing.
In case of interest, PR is welcomed of course.