Closed Bug 1476656 Opened 3 years ago Closed 3 years ago
Allow triggering autocomplete with "[" character
46 bytes, text/x-phabricator-request
|Details | Review|
**Steps to reproduce** 1. Open the console 2. Type `window[` **Expected results** The autocomplete popup opens and show all the accessible properties on the window object. Selecting an element (e.g. "alert") from the list completes the input to `window["alert"]`. **Actual results** The autocomplete popup is not displayed. ---
Priority: -- → P2
Marking this blocked by Bug 1472117 since we'll need to modify the same functions for this bug.
Depends on: 1472117
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: P2 → P1
This patch adds the ability to open the autocomplete popup when typing an opening bracket (i.e. `[`]) in the console input. This impacts a significant amount of function where we assumed that the only way to get a completion was to use a dot. We uses the rename `anylyzeInputString` function to get the completion part from an input, as well as if the user is performing an element access (i.e., using the bracket). We then send that information to the webconsole actor, which send it to the client. This allows us to rely on a single parse of the input and gives us access to this information everywhere we need to, be it on the client or on the server. We allow the user to type property name without quotes, and we add them when the user accept an autocompletion. We also automatically add a closing bracket (i.e. `]`), when it's needed. Some test are added. On the server side to make sure the actor's autocomplete function returns what's expected. We take that as an opportunity to add test for commands. On the client side, tests are added to ensure the different behavior works as expected (check the completion text and the input after accepting the completion when the user entered some letters, or not, with or without quotes, with different quotes, hitting the autocomplete cache, …). A test which accesses the autocomplete cache was modified since the shape of the cache changed to include the last matchProp as well as the isElementAccess boolean.
Comment on attachment 9011371 [details] Bug 1476656 - Trigger autocomplete on bracket; r=Honza. Jan Honza Odvarko [:Honza] has approved the revision.
Attachment #9011371 - Flags: review+
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/3ecd0d2e0006 Trigger autocomplete on bracket; r=Honza.
You need to log in before you can comment on or make changes to this bug.