diff --git a/Configuration.md b/Configuration.md index 3b298eeb..50dfd6a4 100644 --- a/Configuration.md +++ b/Configuration.md @@ -23,6 +23,7 @@ * [Modify the settings.json (User Setting)](#modify-the-settingsjson-user-setting) * java.debug.settings.console * java.debug.settings.forceBuildBeforeLaunch + * java.debug.settings.onBuildFailureProceed * java.debug.settings.hotCodeReplace * java.debug.settings.enableRunDebugCodeLens * [FAQ](#faq) @@ -329,6 +330,8 @@ In some cases, you may want to start your program with the external builder and - `java.debug.settings.forceBuildBeforeLaunch` - Force building the workspace before launching java program, defaults to `true`. Sometimes you may be bothered with the message *"Build failed, do you want to continue?"*, you could disable this setting to suppress the message. +- `java.debug.settings.onBuildFailureProceed` - Sometimes you may be bothered with the message *"Build failed, do you want to continue?"*, you could use this setting to suppress the message and proceed. + - `java.debug.settings.hotCodeReplace` - Reload the changed Java classes during debugging, defaults to `manual`. It supports `manual`, `auto`, `never`. - `manual` - Click the toolbar to apply the changes. ![hcr](https://user-images.githubusercontent.com/14052197/67256313-f5697600-f4b8-11e9-9db6-54540b6350ad.png) diff --git a/README.md b/README.md index b3dc0e59..4f8ff106 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht - never - Never apply the changes. - `java.debug.settings.enableRunDebugCodeLens`: enable the code lens provider for the run and debug buttons over main entry points, defaults to `true`. - `java.debug.settings.forceBuildBeforeLaunch`: force building the workspace before launching java program, defaults to `true`. +- `java.debug.settings.onBuildFailureProceed`: Force to proceed when build fails, defaults to false. - `java.debug.settings.console`: The specified console to launch Java program, defaults to `integratedTerminal`. If you want to customize the console for a specific debug session, please modify the 'console' config in launch.json. - `internalConsole` - VS Code debug console (input stream not supported). - `integratedTerminal` - VS Code integrated terminal. diff --git a/package.json b/package.json index 3dc7b114..f64de636 100644 --- a/package.json +++ b/package.json @@ -636,6 +636,11 @@ "description": "%java.debugger.configuration.forceBuildBeforeLaunch%", "default": true }, + "java.debug.settings.onBuildFailureProceed": { + "type": "boolean", + "description": "%java.debugger.configuration.onBuildFailureProceed%", + "default": false + }, "java.debug.settings.console": { "type": "string", "enum": [ diff --git a/package.nls.json b/package.nls.json index 4cb26773..9a7af5ed 100644 --- a/package.nls.json +++ b/package.nls.json @@ -53,6 +53,7 @@ "java.debugger.configuration.hotCodeReplace.description": "Reload the changed Java classes during debugging. Make sure 'java.autobuild.enabled' is not disabled.", "java.debugger.configuration.enableRunDebugCodeLens.description": "Enable the run and debug code lens providers over main methods.", "java.debugger.configuration.forceBuildBeforeLaunch": "Force building the workspace before launching java program.", + "java.debugger.configuration.onBuildFailureProceed": "Force to proceed when build fails", "java.debugger.configuration.console": "The specified console to launch Java program. If you want to customize the console for a specific debug session, please modify the 'console' config in launch.json.", "java.debugger.configuration.exceptionBreakpoint.skipClasses": "Skip the specified classes when breaking on exception. You could use the built-in variables such as '$JDK' and '$Libraries' to skip a group of classes, or add a specific class name expression, e.g. java.*, *.Foo", "java.debugger.configuration.jdwp.limitOfVariablesPerJdwpRequest.description": "The maximum number of variables or fields that can be requested in one JDWP request. The higher the value, the less frequently debuggee will be requested when expanding the variable view. Also a large number can cause JDWP request timeout.", diff --git a/src/build.ts b/src/build.ts index 1eb1e2bb..8c2a4a80 100644 --- a/src/build.ts +++ b/src/build.ts @@ -9,6 +9,9 @@ import * as commands from "./commands"; import * as lsPlugin from "./languageServerPlugin"; import * as utility from "./utility"; +const JAVA_DEBUG_CONFIGURATION = "java.debug.settings"; +const ON_BUILD_FAILURE_PROCEED = "onBuildFailureProceed"; + export async function buildWorkspace(): Promise { const buildResult = await instrumentOperation("build", async (operationId: string) => { let error; @@ -32,6 +35,9 @@ export async function buildWorkspace(): Promise { } async function handleBuildFailure(operationId: string, err: any): Promise { + const configuration = vscode.workspace.getConfiguration(JAVA_DEBUG_CONFIGURATION); + const onBuildFailureProceed = configuration.get(ON_BUILD_FAILURE_PROCEED); + if (err instanceof utility.JavaExtensionNotEnabledError) { utility.guideToInstallJavaExtension(); return false; @@ -47,8 +53,8 @@ async function handleBuildFailure(operationId: string, err: any): Promise