launch.json debug any file as module
See original GitHub issueEnvironment data
- VS Code version: 1.33.0
- Extension version: 2019.3.6558
- Python version: Python 3.6.7 (miniconda)
Feature Suggestion
It would be great to be able to debug arbitrary files as modules without having to hardcode their path in launch.json
. The best I could find was the following which at least allows to debug any file in a given directory as module.
{
"configurations": [
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "src.nn.models.${fileBasenameNoExtension}"
}
]
}
Not sure if this can be done by the Python extension or would have to be implemented by VS Code itself, but basically I’m suggesting something similar to ${fileBasenameNoExtension}
that returns the full dotted “path” to a file from a project’s root?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:25
- Comments:7
Top Results From Across the Web
How to debug a Python module in Visual Studio Code's ...
Actually, there is a very simple option to do this I found by accident while trying to edit the launch.json file. "type": "python",...
Read more >launch.json debug any file as module · Issue #5184 - GitHub
It would be great to be able to debug arbitrary files as modules without having to hardcode their path in launch.json .
Read more >Debugging configurations for Python apps in Visual Studio Code
Select the create a launch.json file link (outlined in the image above) or use the Run > Open configurations menu command. A configuration...
Read more >Develop and debug modules Azure IoT Edge modules using ...
Use Visual Studio Code to develop and debug modules for Azure IoT Edge ... A .vscode folder contains configuration file launch.json.
Read more >Using Visual Studio Code to debug Jest based unit tests
Step 1 Enabling debugging in our project · We will click on the debug icon (left hand sidebar). · Click on the add...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d also like to see this as a native solution. Running the scripts as modules can help a lot with relative imports when I try to debug single files.
You can use “Command Variable” extension to debug current module:
"module": "${command:extension.commandvariable.file.relativeDirDots}.${fileBasenameNoExtension}"