Autocompletion should be smarter and fill any common prefix of the available suggestions

RESOLVED FIXED in Firefox 22



Developer Tools: Console
5 years ago
5 years ago


(Reporter: past, Unassigned)


Firefox 22

Firefox Tracking Flags

(firefox22 verified)


I've been hitting this for a long time and I always thought we had a bug on file for it, but I couldn't find one, so here it is:

1) open the web console
2) type win<TAB>.locat<TAB><ENTER>

Expected result:

window.location is evaluated.

Actual result:

window.locat is actually evaluated

This happens because there are 2 available completions for window.locat, window.location and window.locationbar, and the console expects an explicit user selection between the two. All shells nowadays are smart enough to complete up to the point where the completion is no longer unambiguous. We shouldn't be penalizing fast typists for no good reason.
Agreed that we should be doing something about this. I think we should consider how completion works in GCLI as we do this because we want to bring gcli and the web console closer together.

GCLI does the following:
* TAB always completes to something, and it tells you what in grey as a prompt
* UP/DOWN toggle from the available completions
* CTRL+TAB should (soon) complete to the longest unambiguous prefix

The thinking behind this is 2 fold:
* It's obvious what's going to happen, and not hard to guess how to use it
* It allows GCLI to get gradually smarter about how it completes. For example if the user always completes loc<TAB> to location rather than locationbar then we should suggest that first.
Panos: thanks for your report. Agreed with the suggestion. I also filed some autocomplete-related bug reports that would, hopefully, make the console completion nicer to use. We should take the time to work on them, some time soon.
Here are my two thoughts:

1) Most probably after bug 831693, the AutocompletePopup will be capable of auto selecting the first suggestion from the popup. Which means if the user presses tab on 'window.lo' it will automatically get completed to the first item.

2) But right now, since web console populates the suggestions in Lexicographical order starting from top, thus the last Lexicographical element will be selected. For ex pressing tab at 'w' will autocomplete to 'window' if there are lets say 'watch', 'win' and 'window' as suggestions. Thus I think that the suggestions should be sorted such that the closest element from the input box should be the first element when you sort the list in lexicographical order.

I can take it if this is the intent.
Fixed by bug 831693 . If you feel that the result now is not what is desirable, please reopen
Last Resolved: 5 years ago
status-firefox22: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
Verified fixed with Firefox 22 beta 5 (build ID: 20130612084701) on Ubuntu 12.10 32bit and Mac OSX 10.8.3, using the STR from the description.
status-firefox22: fixed → verified
QA Contact: manuela.muntean
You need to log in before you can comment on or make changes to this bug.