Raghavan Vidhyasagar
Raghavan Vidhyasagar

Reputation: 493

How to debug any file in node JS without specifying the file name in launch,json

Check this image

I want to debug both workout.js and test.js but vscode is debugging only the workout.js how do I set the file name dynamic. so I can debug any js file with one launch.json config

Like

"program": "${workspaceFolder}/${currentFileName}.js",

Upvotes: 1

Views: 858

Answers (3)

Raghavan Vidhyasagar
Raghavan Vidhyasagar

Reputation: 493

Refer to the documentation for details.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Node js",
            "program": "${file}",
            "request": "launch",
            "skipFiles": ["<node_internals>/**"],
            "type": "node"
        }
    ]
}

Upvotes: 1

Kishan Vaishnani
Kishan Vaishnani

Reputation: 192

The easy way is to add multiple settings inside your single lunch config file. and whenever you want to debug any then choose that name while debugging

Upvotes: 0

Bernat
Bernat

Reputation: 554

Take a look at the official documentation about variable substitution in Debugging and Task configuration files, there are a few that can be used to achieve what you want.

Upvotes: 0

Related Questions