Vscode: Support launching npm scripts from the package.json

Created on 11 Jun 2018  路  13Comments  路  Source: microsoft/vscode

I work for a project with many npm modules.
I use the new feature "NPM Scripts", it works well, but I would like to suggest two enhancements :

  • A button to shrink all modules in the npm script list view -> extracted into #54645
  • Provide in source code file list a contextual menu where scripts can be launched.

Thanks !

feature-request verification-needed verified

Most helpful comment

@texastoland there is currently no API for an extension to add a clickable button in the gutter.

I麓ve now settled on the actions as links in the hover that is shown when hovering over the script name.

image

All 13 comments

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@edimitchel in the future please file a feature request per issue, otherwise we cannot really track them. I麓ll focus this issue on the launch a script from the source code. I麓ve adjusted the title of this issue accordingly and extracted the other request into #54645

Fixed with 5c5f93cdbcc763b94ed996d73ed4e5329e60d7a8. There is now a code lens shown for npm scripts that supports to run/debug the script.
image

The codelens can be disabled using the setting npm.scriptCodeLens.enable.

Reopening to collect feedback on whether this should be enabled by default.

Feedback from twitter
image

I like the feature, so I'd vote for enabled by default 馃憤.

But we need a less invasive design. With the current implementation, an extra row gets added in the package.json basically, which makes its readability a mess

image

I like @beeman suggestion to move it into the gutter. Or just have it on "hover" somehow?

Regarding the options for a less invasive implementation:

  • gutter/decorators: there is currently no support in the API for getting a click event on a decoration
  • context menu actions: show the Run action in the context menu of the editor, not easily discoverable.
  • hover actions: gitlens has started to provide actions on hover
    image
  • render the script name as a link and clicking the link runs the script.

My thinking is to disable the feature until we have a less invasive implementation.

I find myself collapsing scripts because they have doubled in height. I love GitLens's hover actions. In this case there's no extra context to provide. In the case of the tweet it looks quite noisy. A minimal compromise could be a button in the gutter on hover?

@texastoland there is currently no API for an extension to add a clickable button in the gutter.

I麓ve now settled on the actions as links in the hover that is shown when hovering over the script name.

image

馃憤馃徑 it looks nicer only visible in context thank you!

Fixed with 73b72464b3f71db7ac3b763f37e84769bd411a7b

Works nicely -> verified

Thank for for your perfect work !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrkiley picture mrkiley  路  3Comments

v-pavanp picture v-pavanp  路  3Comments

omidgolparvar picture omidgolparvar  路  3Comments

biij5698 picture biij5698  路  3Comments

curtw picture curtw  路  3Comments