Closed
Bug 1267140
Opened 9 years ago
Closed 5 years ago
Allow auto-completing non-enumerable properties and member functions return types of known types
Categories
(DevTools :: Console, enhancement, P3)
DevTools
Console
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1460518
People
(Reporter: sebo, Unassigned)
References
(Blocks 3 open bugs)
Details
(Whiteboard: [btpp-backlog])
There should be auto-completion for global objects and known variable types to help while typing.
Examples:
Typing 'getElementById("foo").' (without single quotes, of course) into the command line should provide you with a list of suggestions for the HTMLElement or SVGElement interface.
Typing '/foo/.source.' should show the suggestions for the String interface.
The same is valid for the command line APIs $, $$, $0 and $_. I.e. when you type '$("div").' into the command line, you should see all options of the HTMLElement interface (in case it returns an element).
Firebug has this feature implemented. It's list of known types can be seen here:
https://github.com/firebug/firebug/blob/master/extension/content/firebug/console/autoCompleter.js#L1483-L1673
Sebastian
Reporter | ||
Updated•9 years ago
|
Summary: Allow auto-completion non-enumerable properties and member functions return types of known types → Allow auto-completing non-enumerable properties and member functions return types of known types
Comment 1•9 years ago
|
||
Nice idea, this would be a good enhancement
Priority: -- → P3
Whiteboard: [btpp-backlog]
Updated•9 years ago
|
Blocks: important-firebug-gaps
Comment 2•9 years ago
|
||
> Typing '/foo/.source.' should show the suggestions for the String interface.
> The same is valid for the command line APIs [...] $0 and $_.
I would argue that those are two separate bugs: the first about parsing JS more finely (as is already done for strings and arrays) and the second about the auto-completion code not knowing very much about the helper APIs. I can't find bugs for any of them, though. Not being able to auto-complete "$0." is definitely something that has bugged me.
> https://github.com/firebug/firebug/blob/master/extension/content/firebug/console/autoCompleter.js#L1483-L1673
I think if I redid this, I would have gone with a list of pure functions instead, that were safe to call from auto-completion. One could do something like bug 943496 to make it safer. (Firebug naively assumes that functions starting with "get" and "$" are pure, which is less safe, but works nicely in practice and solves the "$" and "$$" cases as a side effect.)
Anyway, I think nowadays the proper way to solve this would be to use tern.js's engine for auto-completion. (See e.g. http://ternjs.net/doc/demo/.)
Updated•6 years ago
|
Product: Firefox → DevTools
Reporter | ||
Comment 3•6 years ago
|
||
Could this be something for the JsTerm enhancement milestones?
Sebastian
Flags: needinfo?(nchevobbe)
Comment 4•6 years ago
|
||
We are looking at something similar to Chrome's eager evaluation for future js term milestones.
Firebug's list approach might be an interesting stopgap or alternative data source.
I added it to the enhancements backlog, but would like to hear Nicolas' thoughts on using the list approach.
Comment 5•6 years ago
|
||
It seems like something we could do indeed.
We do have better parsing on the server now, which gives us an AST, so in some cases we could choose to retrieve things from prototypes (like we do for string, array and number literals for now).
Flags: needinfo?(nchevobbe)
Comment 6•5 years ago
|
||
Duping for the eager evaluation meta, as work is starting there.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•