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.
<rdar://problem/22393224>
Created attachment 259942 [details] Patch
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.
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.
(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.
Comment on attachment 259942 [details] Patch Clearing flags on attachment: 259942 Committed r188967: <http://trac.webkit.org/changeset/188967>
All reviewed patches have been landed. Closing bug.
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.