WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
148368
Web Inspector: Command-Enter should evaluate selected JS in Debugger/Sources
https://bugs.webkit.org/show_bug.cgi?id=148368
Summary
Web Inspector: Command-Enter should evaluate selected JS in Debugger/Sources
Nikita Vasilyev
Reported
2015-08-22 20:27:18 PDT
Light Table has an inline evaluation. Pressing Command-Enter runs the selected code and shows the return value inline, right by the code.
http://lighttable.com/#features
Chrome DevTools have a Control-Shift-E shortcut to evaluate selected text in the console. I think, eventually we need to do something like Light Table. There are quite a few nuances and I could take while to get it right. So, for now, I propose to implement Command-Enter shortcut to evaluate the selected code in the console.
Attachments
Patch
(2.63 KB, patch)
2015-08-26 02:45 PDT
,
Nikita Vasilyev
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2015-08-22 20:27:46 PDT
<
rdar://problem/22393224
>
Nikita Vasilyev
Comment 2
2015-08-26 02:45:58 PDT
Created
attachment 259942
[details]
Patch
Timothy Hatcher
Comment 3
2015-08-26 02:51:03 PDT
Comment on
attachment 259942
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=259942&action=review
> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:730 > + if (modeName !== "javascript" && modeName !== "htmlmixed")
I think there is a way to get the inner mode for the selection, that way we know if it is JS even inside html. Right now I think that will allow non-JS to be evaluated from HTML. The completion controller has code for looking at inner mode I think.
Timothy Hatcher
Comment 4
2015-08-26 02:51:26 PDT
Comment on
attachment 259942
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=259942&action=review
>> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:730 >> + if (modeName !== "javascript" && modeName !== "htmlmixed") > > I think there is a way to get the inner mode for the selection, that way we know if it is JS even inside html. Right now I think that will allow non-JS to be evaluated from HTML. The completion controller has code for looking at inner mode I think.
Oh, now I see your comment in the ChangeLog. Sounds good.
Nikita Vasilyev
Comment 5
2015-08-26 02:57:20 PDT
(In reply to
comment #4
)
> Comment on
attachment 259942
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=259942&action=review
> > >> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:730 > >> + if (modeName !== "javascript" && modeName !== "htmlmixed") > > > > I think there is a way to get the inner mode for the selection, that way we know if it is JS even inside html. Right now I think that will allow non-JS to be evaluated from HTML. The completion controller has code for looking at inner mode I think. > > Oh, now I see your comment in the ChangeLog. Sounds good.
Currently, pressing Command-Enter inside a resource doesn't do anything at all. It doesn't insert a new line. We may revisit what does it do for HTML in the future, but I don't have any other ideas at the moment.
WebKit Commit Bot
Comment 6
2015-08-26 09:06:38 PDT
Comment on
attachment 259942
[details]
Patch Clearing flags on attachment: 259942 Committed
r188967
: <
http://trac.webkit.org/changeset/188967
>
WebKit Commit Bot
Comment 7
2015-08-26 09:06:46 PDT
All reviewed patches have been landed. Closing bug.
Nikita Vasilyev
Comment 8
2015-09-14 01:55:33 PDT
Looking into this two weeks later with a fresh eye, I think Command-Enter should show the exact same popover as on hover. Evaluating in the console seems too disconnected from the source code and requires a bit of an extra mental effort not to lose the context.
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