Skip to content

Commit 0755aa2

Browse files
authored
Fixes #888 (#889)
* Fixes #888 * PR fixes - changed to boolean * Squashed commit of the following: commit b76da40b8b3488f7e3840e20780e8757d1854586 Author: srfrnk <[email protected]> Date: Sat Oct 10 09:11:32 2020 +0100 removed newline at EOF commit c80801c90e73942ab69f5266f5a5e525a236bd39 Author: srfrnk <[email protected]> Date: Sat Oct 10 09:10:45 2020 +0100 Revert "removed newline at EOF" This reverts commit 8e2f872. commit bd90bf2 Author: srfrnk <[email protected]> Date: Sat Oct 10 09:10:07 2020 +0100 added newline at EOF commit 8e2f872 Author: srfrnk <[email protected]> Date: Sat Oct 10 09:04:51 2020 +0100 removed newline at EOF commit c997a6c Author: Srfrnk <[email protected]> Date: Sat Oct 10 09:03:55 2020 +0100 Removed newline at EOF commit 7738ddf Author: Srfrnk <[email protected]> Date: Sat Oct 10 09:03:00 2020 +0100 Edit outside vscode to prevent adding newline at EOF commit 586824f Author: Srfrnk <[email protected]> Date: Sat Oct 10 09:01:58 2020 +0100 edit outside vscode to prevent whitespace changes.
1 parent 2450f63 commit 0755aa2

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

Configuration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* [Modify the settings.json (User Setting)](#modify-the-settingsjson-user-setting)
2424
* java.debug.settings.console
2525
* java.debug.settings.forceBuildBeforeLaunch
26+
* java.debug.settings.onBuildFailureProceed
2627
* java.debug.settings.hotCodeReplace
2728
* java.debug.settings.enableRunDebugCodeLens
2829
* [FAQ](#faq)
@@ -329,6 +330,8 @@ In some cases, you may want to start your program with the external builder and
329330

330331
- `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.
331332

333+
- `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.
334+
332335
- `java.debug.settings.hotCodeReplace` - Reload the changed Java classes during debugging, defaults to `manual`. It supports `manual`, `auto`, `never`.
333336
- `manual` - Click the toolbar to apply the changes.
334337
![hcr](https://user-images.githubusercontent.com/14052197/67256313-f5697600-f4b8-11e9-9db6-54540b6350ad.png)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
108108
- never - Never apply the changes.
109109
- `java.debug.settings.enableRunDebugCodeLens`: enable the code lens provider for the run and debug buttons over main entry points, defaults to `true`.
110110
- `java.debug.settings.forceBuildBeforeLaunch`: force building the workspace before launching java program, defaults to `true`.
111+
- `java.debug.settings.onBuildFailureProceed`: Force to proceed when build fails, defaults to false.
111112
- `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.
112113
- `internalConsole` - VS Code debug console (input stream not supported).
113114
- `integratedTerminal` - VS Code integrated terminal.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,11 @@
636636
"description": "%java.debugger.configuration.forceBuildBeforeLaunch%",
637637
"default": true
638638
},
639+
"java.debug.settings.onBuildFailureProceed": {
640+
"type": "boolean",
641+
"description": "%java.debugger.configuration.onBuildFailureProceed%",
642+
"default": false
643+
},
639644
"java.debug.settings.console": {
640645
"type": "string",
641646
"enum": [

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"java.debugger.configuration.hotCodeReplace.description": "Reload the changed Java classes during debugging. Make sure 'java.autobuild.enabled' is not disabled.",
5454
"java.debugger.configuration.enableRunDebugCodeLens.description": "Enable the run and debug code lens providers over main methods.",
5555
"java.debugger.configuration.forceBuildBeforeLaunch": "Force building the workspace before launching java program.",
56+
"java.debugger.configuration.onBuildFailureProceed": "Force to proceed when build fails",
5657
"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.",
5758
"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",
5859
"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.",

src/build.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import * as commands from "./commands";
99
import * as lsPlugin from "./languageServerPlugin";
1010
import * as utility from "./utility";
1111

12+
const JAVA_DEBUG_CONFIGURATION = "java.debug.settings";
13+
const ON_BUILD_FAILURE_PROCEED = "onBuildFailureProceed";
14+
1215
export async function buildWorkspace(): Promise<boolean> {
1316
const buildResult = await instrumentOperation("build", async (operationId: string) => {
1417
let error;
@@ -32,6 +35,9 @@ export async function buildWorkspace(): Promise<boolean> {
3235
}
3336

3437
async function handleBuildFailure(operationId: string, err: any): Promise<boolean> {
38+
const configuration = vscode.workspace.getConfiguration(JAVA_DEBUG_CONFIGURATION);
39+
const onBuildFailureProceed = configuration.get<boolean>(ON_BUILD_FAILURE_PROCEED);
40+
3541
if (err instanceof utility.JavaExtensionNotEnabledError) {
3642
utility.guideToInstallJavaExtension();
3743
return false;
@@ -47,8 +53,8 @@ async function handleBuildFailure(operationId: string, err: any): Promise<boolea
4753
vscode.commands.executeCommand("workbench.actions.view.problems");
4854
}
4955

50-
const ans = await vscode.window.showErrorMessage("Build failed, do you want to continue?",
51-
"Proceed", "Fix...", "Cancel");
56+
const ans = onBuildFailureProceed ? "Proceed" : (await vscode.window.showErrorMessage("Build failed, do you want to continue?",
57+
"Proceed", "Fix...", "Cancel"));
5258
sendInfo(operationId, {
5359
operationName: "build",
5460
choiceForBuildError: ans || "esc",

0 commit comments

Comments
 (0)