New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 666783 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 657982
Owner: ----
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Support triggering DevTools snippets via console using snippet:[name] syntax

Project Member Reported by addyo@chromium.org, Nov 18 2016

Issue description

Version: All
OS: All

What steps will reproduce the problem?
(1) Attempt to access snippets without leaving the console
(2) This cannot be done today. You need to navigate to Sources > Snippets.

What is the expected result?

To reduce the number of steps needed to trigger a snippet, what if we introduced a "snippet:" syntax in the DevTools console. Typing the name of the snippet after snippet: would begin to autocomplete it based on filename. The developer can then hit enter to run the snippet without needing to leave the console at all.

e.g 

snippet: conso
snippet: console-image.js
         console-formatters.js
[hits enter -> runs]

Request from Twitter: https://twitter.com/darcy/status/799662234590937089

What happens instead?

Sadness ensues and unicorns cry. Many more steps are needed to go to the Snippets sub-panel, locate your snippet and then run it. The history autocompletion we offer isn't quite good enough here as you could have numerous utilities defined in a single Snippet file and it's probably unrealistic to expect folks to remember everything they have defined there.

 
This is great, thanks for making this ticket Addy! Would love to see this get added to DevTools. Would actually make snippets WAAAAAAY more useful and I'd probably be autocompleting the heck out of them in dev.

I'm attaching an image of the current, less fun/easy, workflow for thoroughness.
Cxj23adUoAAFGYv.jpg
27.0 KB View Download

Comment 2 by l...@chromium.org, Nov 18 2016

Blocking: 657982
Cc: chowse@chromium.org einbinder@chromium.org
Mergedinto: 657982
Status: Duplicate (was: Untriaged)
Thank you for the request.  Sorry to hear about the sadness and unicorns.  Since there is another bug  crbug.com/657982  tracking improvements to snippet workflows, I'm merging this bug into the other.  Please feel free to comment on that one!

From the other bug, they discussed having snippets runnable from the command menu (ctrl-shift-P) and the console via "console.snippet.myHelpfulSnippet()".  I like your suggestion of using a "snippet:[name]" syntax, let's add it to the discussion there.


Comment 3 by l...@chromium.org, Nov 18 2016

Blocking: -657982

Sign in to add a comment