Make console autocompletion work on $0

VERIFIED FIXED in Firefox 65

Status

defect
P1
normal
VERIFIED FIXED
4 years ago
7 months ago

People

(Reporter: bgrins, Assigned: nchevobbe)

Tracking

(Blocks 4 bugs)

Trunk
Firefox 65
Dependency tree / graph

Firefox Tracking Flags

(firefox65 verified)

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 attachment)

Reporter

Description

4 years ago
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)
Reporter

Comment 2

2 years ago
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

Updated

Last year
Product: Firefox → DevTools
Duplicate of this bug: 1369608
Blocks: 1458831

Updated

11 months ago
Whiteboard: [polish-backlog] → [boogaloo-reserve] [polish-backlog]
Assignee

Updated

8 months ago
Whiteboard: [boogaloo-reserve] [polish-backlog] → [boogaloo-mvp] [polish-backlog]
Priority: P3 → P2
Assignee

Updated

7 months ago
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: P2 → P1
Assignee

Comment 5

7 months ago
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.

Comment 6

7 months ago
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/18eddae8a268
Make autocompletion work on $_ and $0; r=bgrins.

Comment 7

7 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/18eddae8a268
Status: ASSIGNED → RESOLVED
Closed: 7 months 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.