Tuesday, 4 April 2017

Dynamic launch.json program javascript file

I'm running through a series of Pluralsight tutorials on NodeJS and have a directory with ~10 JS files in proving various concepts.

Every time I want to F5 debug my code, I have to ensure that my "program:" param is set to the current javascript file, which is pretty annoying.

Is there a way of dynamically doing this to save me needing to double check every 3 minutes?

If I simply take out the file name but leave "program:" I get the following error:

Cannot launch program 'C:\node\NodeJS Pluralsight\js'; setting the 'outFiles' attribute might help.

Here's my current launch.json:

"configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${workspaceRoot}/js/currentFile.js", // What I'd like to change
        "outFiles": [ "${workspaceRoot}/**/*.js" ]
    },
    {
        "type": "node",
        "request": "attach",
        "name": "Attach to Process",
        "address": "localhost",
        "port": 5858
    }



via Jay Gould

No comments:

Post a Comment