Closed Bug 1476656 Opened 3 years ago Closed 3 years ago

Allow triggering autocomplete with "[" character


(DevTools :: Console, defect, P1)



(firefox64 fixed)

Firefox 64
Tracking Status
firefox64 --- fixed


(Reporter: nchevobbe, Assigned: nchevobbe)


(Depends on 1 open bug, Blocks 1 open bug)


(Whiteboard: [boogaloo-mvp])


(1 file)

**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.

Blocks: 1458831
Priority: -- → P2
Whiteboard: [boogaloo-mvp]
Marking this blocked by Bug 1472117 since we'll need to modify the same functions for this bug.
Depends on: 1472117
Assignee: nobody → nchevobbe
Priority: P2 → P1
Depends on: 1217198
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
Trigger autocomplete on bracket; r=Honza.
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
Depends on: 1536088
Depends on: 1541422
You need to log in before you can comment on or make changes to this bug.