Closed Bug 1216632 Opened 10 years ago Closed 7 years ago

Make console autocompletion work on $0

Categories

(DevTools :: Console, defect, P1)

defect

Tracking

(firefox65 verified)

VERIFIED FIXED
Firefox 65
Tracking Status
firefox65 --- verified

People

(Reporter: bgrins, Assigned: nchevobbe)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [boogaloo-mvp] [polish-backlog])

User Story

As a web developer I want to have access to the properties of the inspected element without having to remember all of them and write their full names.

Attachments

(1 file)

Right now if you run `$0.` in the console you don't get any autocompletion. However if you do `foo = $0;` then run `foo.` you do. I think it has to do with the fact that $0 is added as an extra binding for the debugger and the JSPropertyProvider we use for webconsole just looks in the normal environment.
No longer blocks: 1111089
I stumble over this issue every day. This bug limits the usefulness of $0 a lot, because you have to know and type out all the properties by yourself. Brian, it sounded like you had an idea how to fix this. Could this please get some priority? Sebastian
User Story: (updated)
Flags: needinfo?(bgrinstead)
I agree this would be a great feature to have. But I don't expect to have the cycles to look into this in the near future as we are focused right now on getting the new console frontend shipped to release. If someone wanted to look into this, I'd start in the JSPropertyProvider, where we have some special case handing for `this` [0]. I expect we could add something similar for $0. $0 is special cased in the backend as a WebConsoleCommand [1], and we should be able to do a call similar to what is being done there, if we pass the selected node into it. In that case, the selectedNode object is created from a property sent from client `selectedNodeActor` [2]. [0]: https://dxr.mozilla.org/mozilla-central/source/devtools/shared/webconsole/js-property-provider.js#228-235 [1]: https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/webconsole/utils.js#379-383 [2]: https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/webconsole.js#1344-1349
Flags: needinfo?(bgrinstead)
Priority: -- → P3
Product: Firefox → DevTools
Whiteboard: [polish-backlog] → [boogaloo-reserve] [polish-backlog]
Whiteboard: [boogaloo-reserve] [polish-backlog] → [boogaloo-mvp] [polish-backlog]
Priority: P3 → P2
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: P2 → P1
To make $0 autocompletion work, we need to pass the current selectedNode actor from the frontend, so we can retrieve the object reference later. For $_, we need the webconsole actor reference to be able to retrieve the last input result. Since the list of parameters of JsPropertyProviders was getting a bit long, we transform them in an object so it's more legible on the consumer side. Mochitests are added for both helpers to ensure this work as expected.
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/18eddae8a268 Make autocompletion work on $_ and $0; r=bgrins.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
I can verify that the autocompletion for $0 and $_ works in Nightly 2018-11-15, while it didn't work in 2018-11-14. This was one of the major regressions on the transition from Firebug to the DevTools, especially $0. So, thank you very much for this change, Nicolas! Sebastian
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: