Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tomereli opened this issue Mar 11, 2021 · 2 comments · Fixed by #984
Closed

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

tomereli opened this issue Mar 11, 2021 · 2 comments · Fixed by #984
Assignees
Milestone

Comments

@tomereli
Copy link

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

@testforstephen
@v-wenkecheng

@elad-eyal
Copy link

I think the problem is that the env var is treated as string but the port expects a number only

@tomereli
Copy link
Author

I think the problem is that the env var is treated as string but the port expects a number only

Yes, this is a feature request to fix that - I asked about it on the vscode-java-debug gitter and @testforstephen asked me to open this feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants