From fabcf755e61188c58ceaab69d0e1c6e80035b649 Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Wed, 3 Jun 2020 19:39:08 +0200 Subject: [PATCH] New launch config to start & wait for debugger Signed-off-by: Fred Bricon --- .vscode/launch.json | 14 ++++++++++++++ src/javaServerStarter.ts | 8 +++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 9fe5d537..644541c1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,6 +13,20 @@ "outFiles": [ "${workspaceRoot}/dist/**/*.js" ], "preLaunchTask": "npm: watch" }, + { + "name": "Launch Extension & Wait for remote debugger", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], + "stopOnEntry": false, + "sourceMaps": true, + "outFiles": [ "${workspaceRoot}/dist/**/*.js" ], + "preLaunchTask": "npm: watch", + "env": { + "SUSPEND_SERVER":"true" + } + }, { "name": "Launch Tests", "type": "extensionHost", diff --git a/src/javaServerStarter.ts b/src/javaServerStarter.ts index 01efd8bf..eb1ca67f 100644 --- a/src/javaServerStarter.ts +++ b/src/javaServerStarter.ts @@ -24,9 +24,11 @@ export function prepareExecutable(requirements: RequirementsData, xmlJavaExtensi function prepareParams(requirements: RequirementsData, xmlJavaExtensions: string[], context: ExtensionContext): string[] { let params: string[] = []; if (DEBUG) { - params.push('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1054,quiet=y'); - // suspend=y is the default. Use this form if you need to debug the server startup code: - //params.push('-agentlib:jdwp=transport=dt_socket,server=y,address=1054'); + if (process.env['SUSPEND_SERVER'] === 'true') { + params.push('-agentlib:jdwp=transport=dt_socket,server=y,address=1054'); + } else { + params.push('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1054,quiet=y'); + } } let vmargsCheck = workspace.getConfiguration().inspect(xmlServerVmargs).workspaceValue; if (vmargsCheck !== undefined) {