Description
Requested feature
Support port numbers in attach debug configurations as strings rather than numbers exclusively.
{
"name": "Python: Current File",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": "1234"
}
Motivation
The attach debug configurations expect a number as port number rather than a string. This prevents variable substitution in launch.json
. As an example, the following configuration raises an error on the port
key: Incorrect type. Expected "number"
.
{
"name": "Python: Current File",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": "${env:DEFAULT_DEBUGGER_PORT}"
},
"console": "integratedTerminal"
}
Use case
Assume that you have to debug your application by attaching to a running process. Assume that you package and debug the application into a container by attaching VSCode to the running container. Finally, assume that you have to debug parallel instances of the application on your local machine. In this scenario each debugger must use a distinct port (this is the case for containers in a podman pod at least because they share the same network). The port could be supplied as an environment variable to each container.