I use goland(same as webstorm/intellij etc) IDE and in debug configuration there is a place when you can configure working directory
Now I try to work with VSCODE and I dont find this configuration , after a bit research I find the following json which should handle this but dont find the right place for working directory
e.g. this is my working directory
/Users/i022226/go/src/myapp
"configurations": [{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceRoot}"
},
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceRoot}"
},
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${fileDirname}",
"env": {},
"args": [],
"showLog": true
}
In the launch.json
there is add configuration button and when I type cwd
I dont get any entry, any idea ?
In this post the cwd
is under the option
but I dont find the option
https://github.com/Microsoft/vscode/issues/856
To open the Settings editor, use the following VS Code menu command: On Windows/Linux - File > Preferences > Settings. On macOS - Code > Preferences > Settings.
Depending on your platform, the user settings file is located here: Windows: %APPDATA%\Code\User\settings. json.
Here's an example launch.json
to run a Python module in a project subfolder based on Tals's answer:
{
// 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: Launch",
"type": "python",
"request": "launch",
"module": "module_source_folder.filename",
"cwd": "${workspaceFolder}/examples/folder_with_test_files",
"args": ["-f", "input_filename"]
}
]
}
Note that cwd
must come before args
or it won't work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With