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
}
Fixed this accidentally by rescoping my directory to a nested directory inside my project folder, that subsequently recreated the launch.json file. The configuration array is now:
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${file}"
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"address": "localhost",
"port": 5858
}
]
where ${file} has been used to represent the current file.
Related
When I am debugging my python code it skips over code not written by me. I've set justmycode to false and I've tried updating request however, it won't accept any values except launch or attach and purpose is set to debug-test. Nothing seems to work.
My JSON file:
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode":false,
"purpose": ["debug-test"]
}
]
}
The message from the debugger(yes, I stepped in not over):
Frame skipped from debugging during step-in.
Note: may have been skipped because of "justMyCode" option (default == true). Try setting "justMyCode": false in the debug configuration (e.g., launch.json).
Sorry if this a stupid question I am a newbie and feeling totally over my head in my internship.
Literally this is my entire code. The message from the debugger appears when I try to step into execute().
pQuery=p.logquery()
pQuery.execute()
I had a similar problem just now and it suddenly started working when I set the justMyCode option to the end of the configuration without a comma at the end of the line.
So, not working:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Aktuelle Datei",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false,
}
]
}
And working example:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Aktuelle Datei",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
}
]
}
I cannot fathom why this is the case. If this works for you as well, please let me know.
The official docs on how to do it are here.
The OP was specifically adding a launch configuration for debugging tests. However, over here it's mentioned you should set "request": "test" for "for justMyCode to work with test debugging".
{
"name": "Python: Debug Tests",
"type": "python",
"request": "test",
"program": "${file}",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false
}
Which is not so clearly explained in the official docs... but worked for me.
In Visual Studio Code, in the launch.json file that launches the app I'm writing, how do I add command line arguments?
As described in the documentation, you need to use the args attribute. E.g.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug App",
"program": "${workspaceFolder}/main.js",
"args": ["arg1", "arg2", "arg3"]
}
]
}
I pass arguments by this way for the python program, it may work for nodejs:
{
"type": "node",
"request": "launch",
"name": "Debug App",
"program": "${workspaceFolder}/main.js",
"args": ["--arg1", "value1", "--arg2", "value2"]
}
I am trying to use the vs code debugger for my node.js application and all the commands and code but when i apply the break point it goes back to the main files and function of the nodejs and npm files instead of going back step by step to the service and then storage, brake points not working properly for my apis any body can help
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?
linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}"
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/app/app.js"
},
{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"debug"
],
"port": 9229
},
{
"type": "node",
"request": "launch",
"name": "My Debugger",
"program": "${workspaceFolder}\\index.js"
}
]
}
Have you tried attaching to a node process?
Step 1: Run the code.
Step 2: Press CMD + SHIFT + P then search for "Attach to Node Process" and it will list the running processes.
Step 3: Choose the process you want to attach to.
This enables debugging.
In am trying to debug my python script in VS Code but the debugger is not even starting. The blue bar keeps on loading after clicking the green play button and the bar below which was supposed to turn Orange doesn't change and is blue as it is.
What I tried?
1. Adding the path in launch.json file.
Here is my launch.json file.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
},
{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"pythonPath": "${config:python.pythonPath}"
},
{
"name": "Python: Terminal (external)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal",
"pythonPath": "${config:python.pythonPath}"
},
I have configured the path correctly in Windows advanced settings and in VS code workspace setting as well.
{
"python.pythonPath": "C:/Users/Admin/AppData/Local/Programs/Python/Python36-32/python.exe",
"code-runner.runInTerminal": true
}
If I try to run the debug in Python: Current File or Python: Terminal(Integrated), I get this error message:
C:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser>cd c:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:/Users/Admin/AppData/Local/Programs/Python/Python36-32/python.exe C:\Users\Admin\.vscode\extensions\ms-python.python-2018.4.0\pythonFiles\PythonTools\visualstudio_py_launcher.py c:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser 49947 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput c:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser\test.py "
'cmd' is not recognized as an internal or external command,operable program or batch file.
And when I try to run it in Python: Terminal(external) , the IDE sits IDLE.
Any assistance is highly appreciated.
I figured it out.
I just had to add the path "C:\Windows\System32" in the path variable in environmental variables under Advanced System settings.
I've got a basic HelloWorld app based on the electron-hello-world project running on VSCode and able to launch a debug session and the app starts up fine.
I've got a breakpoint set on main.js but it appears to be greyed out with a message:
Breakpoint ignored because generated code not found (source map problem?)
Here is my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"program": "${workspaceRoot}/main.js",
"port": 9222,
"sourceMaps": true,
"diagnosticLogging": true,
"outFiles": [
"${workspaceRoot}"
]
}
]
}
Any help would be much appreciated.
If your generated code is present in "${workspace Root}" then outFiles should be "outFiles": [ "${workspaceRoot}/*.js" ].
For more info link