Languages

VS Code - how to debug current file?

0 points
Asked by:
Laylah-Walsh
234

Currently, to debug a file, I need to enter its path to the 'program' attribute in the launch.json file.

What to do to debug the current file by default without changing launch.json each time?

My launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Debug file",
            "program": "path/to/file.js"
        }
    ]
}
1 answer
0 points
Answered by:
Laylah-Walsh
234

Change your "program" attribute to:

"program": "${file}"

 Correct launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Debug file",
            "program": "${file}"
        }
    ]
}
0 comments Add comment
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join