From d77e395d75ca72906bd3a1e99df7f247803edb0c Mon Sep 17 00:00:00 2001 From: Jinbo Wang Date: Wed, 29 Nov 2017 22:00:37 +0800 Subject: [PATCH] Support stopOnEntry and launchInTerminal in launch.json (#177) * Define launchInTerminal config in launch.json Signed-off-by: Jinbo Wang * Support stopOnEntry and launchInTerminal in launch.json Signed-off-by: Jinbo Wang * Fix review comments * fix review comments --- README.md | 5 +++++ package.json | 22 ++++++++++++++++++++++ src/configurationProvider.ts | 5 ++--- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 649dff0..8eee55d 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,11 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht - `projectName` - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. This setting also works when the debugger looks for the specified main class when launching a program. - `cwd` - The working directory of the program. - `env` - The extra environment variables for the program. +- `stopOnEntry` - Automatically pause the program after launching. +- `console` - The specified console to launch the program. Defaults to `internalConsole`. + - `internalConsole` - VS Code debug console (input stream not supported). + - `integratedTerminal` - VS Code integrated terminal. + - `externalTerminal` - External terminal that can be configured in user settings. ### Attach diff --git a/package.json b/package.json index 86735bd..c455ff0 100644 --- a/package.json +++ b/package.json @@ -111,6 +111,26 @@ "type": "object", "description": "The extra environment variables for the program.", "default": {} + }, + "stopOnEntry": { + "type": "boolean", + "description": "Automatically pause the program after launching.", + "default": true + }, + "console": { + "type": "string", + "enum": [ + "internalConsole", + "integratedTerminal", + "externalTerminal" + ], + "enumDescriptions": [ + "VS Code debug console (input stream not supported).", + "VS Code integrated terminal.", + "External terminal that can be configured in user settings." + ], + "description": "The specified console to launch the program.", + "default": "internalConsole" } } }, @@ -159,6 +179,8 @@ "name": "Debug (Launch)", "request": "launch", "cwd": "^\"\\${workspaceFolder}\"", + "console": "internalConsole", + "stopOnEntry": false, "mainClass": "", "args": "" } diff --git a/src/configurationProvider.ts b/src/configurationProvider.ts index ce322ce..7ec94e3 100644 --- a/src/configurationProvider.ts +++ b/src/configurationProvider.ts @@ -44,6 +44,8 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration request: "launch", // tslint:disable-next-line cwd: "${workspaceFolder}", + console: "internalConsole", + stopOnEntry: false, mainClass: item.mainClass, projectName: item.projectName, args: "", @@ -108,9 +110,6 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration config.request = "launch"; } - // Workaround bug https://github.com/Microsoft/vscode-java-debug/issues/145 - config.stopOnEntry = false; - if (config.request === "launch") { if (!config.mainClass) { const res = (await resolveMainClass(folder ? folder.uri : undefined));