-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Cross-post from microsoft/vscode#180005...
I'm working in a Python project organized as a module hierarchy. To execute a file path/to/file.py, I run it as python -m path.to.file in order to resolve relative imports correctly.
To debug this file, my launch.json config currently looks like this:
{
"name": "Python: Hardcoded Module",
"type": "python",
"request": "launch",
"python": "${command:python.interpreterPath}",
"cwd": "${workspaceFolder}",
"module": "path.to.file",
"args": []
}
...plus another config for every new file I want to debug.
I would love to make a dynamic "Current file run as module from project root" launch config, and it seems to be very nearly possible, but not quite. The missing link is that I need a way to specify ${relativeFileDirname} using a period as the seperator instead of the normal path separator. If that could be achieved through either a new variable or some sort of modifier, it would improve the debugger a ton for projects structured this way!