WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
68161
Web Inspector: Provide completions for object literals, arrays and functions
https://bugs.webkit.org/show_bug.cgi?id=68161
Summary
Web Inspector: Provide completions for object literals, arrays and functions
tonistiigi
Reported
2011-09-15 07:46:12 PDT
Currently completions are only shown for named objects and strings in the console. If expression contains [, ( or { no completions are shown. Would be good if in all cases the value is known completions for the object would show up. Some cases to test with: []. ({'abc':'def'}). (function(){}).b Also "document." provides completions but "(document)." does not.
Attachments
Patch
(5.09 KB, patch)
2011-09-15 08:09 PDT
,
tonistiigi
pfeldman
: review-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
tonistiigi
Comment 1
2011-09-15 08:09:17 PDT
Created
attachment 107497
[details]
Patch Bit mixed feelings about adding this to the utils.rangeOfWord because it only makes sense on moving backwards. On the other hand, implementing the moving between textnodes again in a separate function wouldn't be good either. There is also an edge case where expression could change the input value depending on the execution count. Then there would be possibility that expression is already run first when getting the completions. Other way would be to parse it so that all objects/function bodies remain empty {} and arrays empty []. Then we could at least get the completions for prototype properties. In my opinion while debugging it adds very much more if we get all completions for the actual object. I believe same kind of multi-execution also occures on watched expressions. This should also fix a bug where previously "foo". provided completions but for example "foo{". didn't.
Pavel Feldman
Comment 2
2011-09-15 09:11:42 PDT
Comment on
attachment 107497
[details]
Patch Will it work with regex literals? Like /"/ or /[]]/. I don't think we should implement a JavaScript parser right here.
tonistiigi
Comment 3
2011-09-15 09:31:54 PDT
No it will not. Because / is in the ExpressionStopCharacters array. RegExp("['\"]"). will work fine now though. I realize that there are probably many more constructs like this and they all can't be supported but arrays. objects and functions are very frequently used. I think one of the best use cases for console is not to just type in variables but people use it to quickly try out some new ideas. The prompt should help them out as much as it can. For example I also think functions should complete to arguments array if it is available.
Brian Burg
Comment 4
2014-12-13 18:43:40 PST
This works now.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug