Skip to content

Commit bed2489

Browse files
Support environment variable for port number in launch.json debug configuration (#984)
1 parent 21c9f1a commit bed2489

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@
403403
"description": "%java.debugger.attach.hostName.description%"
404404
},
405405
"port": {
406-
"type": "number",
406+
"type": ["number", "string"],
407407
"description": "%java.debugger.attach.port.description%"
408408
},
409409
"processId": {

src/configurationProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
313313
}
314314
}
315315
} else if (config.request === "attach") {
316-
if (config.hostName && config.port) {
316+
if (config.hostName && config.port && Number.isInteger(Number(config.port))) {
317+
config.port = Number(config.port);
317318
config.processId = undefined;
318319
// Continue if the hostName and port are configured.
319320
} else if (config.processId !== undefined) {

0 commit comments

Comments
 (0)