Skip to content

Support environment variable for port number in launch.json debug configuration #962

Description

Multiple users on the same development server may wish to use a different port number for debugging java applications.
For that, it would be useful if the port number will not be limited to be a number, since the ${env:VAR} notion is (probably) a string. Currently, trying to use environment variable for the port number gives an error.

Environment
  • Operating System: CentOS Linux 8
  • JDK version: JavaSE-1.8 (java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64)
  • Visual Studio Code version: 1.53.2
  • Java extension version: 0.13.0
  • Java Debugger extension version: 0.31.0
Steps To Reproduce
  1. Add a launch.json attach configuration with environment variable for port number:
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Attach to Remote Program",
            "request": "attach",
            "hostName": "localhost",
            "port": "${env:DEBUG_PORT_NUMBER}",
        }
    ]
}
  1. Switch to the debug tab (CTRL+SHIFT+D) and click the start debugging play button

image

Current Result

Cannot start the debugger when using environment variable for port number

Expected Result

Should be able to start the debugger when using an environment variable for port number

Additional Informations

Jinbo Wang (@testforstephen)
v-wenkecheng

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions