0

I am working on a Node.js project in Visual Studio Code. I noticed that when you open the package.json file, there's a debug button above the scripts property. When clicked, it allows me to select and run one of the script settings, which I find very convenient.

Given this feature, I expected there to be an option to add one of these scripts directly to .vscode/launch.json. When I open the launch.json file, there's an add button and I've tried using "node.js: npm" there. It's useful, but I still have to manually enter one of the script values. Plus, if the .vscode/launch.json file doesn't exist, I have to create it manually. While these are simple tasks, I'm doing them manually each time.

I'm starting to wonder if I'm just missing an easier way to do this. Is there a feature or an extension in VSCode that allows adding npm scripts directly to the launch.json file via the UI? If not, are there any recommended workflows or tools to simplify this process?

2
  • not that I know of. It's not that hard to do manually. And npm scripts are autodetected as tasks.
    – starball
    Commented May 25, 2023 at 2:29
  • launch if for debugging not for tasks, see the NPM SCRIPTS view in the Explorer bar
    – rioV8
    Commented May 25, 2023 at 8:19

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.