File tree 3 files changed +18
-5
lines changed
3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ A lightweight Java Debugger based on [Java Debug Server](https://github.com/Micr
19
19
## Requirements
20
20
- JDK (version 1.8.0 or later)
21
21
- VS Code (version 1.17.0 or later)
22
- - [ Language Support for Java by Red Hat] ( https://marketplace.visualstudio.com/items?itemName=redhat.java ) (version 0.12 .0 or later)
22
+ - [ Language Support for Java by Red Hat] ( https://marketplace.visualstudio.com/items?itemName=redhat.java ) (version 0.13 .0 or later)
23
23
24
24
## Install
25
25
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export const JAVA_RESOLVE_CLASSPATH = "vscode.java.resolveClasspath";
13
13
14
14
export const JAVA_RESOLVE_MAINCLASS = "vscode.java.resolveMainClass" ;
15
15
16
- export const JAVA_BUILD_WORKSPACE = "vscode. java.buildWorkspace " ;
16
+ export const JAVA_BUILD_WORKSPACE = "java.workspace.compile " ;
17
17
18
18
export const JAVA_EXECUTE_WORKSPACE_COMMAND = "java.execute.workspaceCommand" ;
19
19
Original file line number Diff line number Diff line change @@ -79,10 +79,23 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
79
79
// log a warning message and continue, since logger failure should not block debug session
80
80
console . log ( "Cannot set log level to java debuggeer." )
81
81
}
82
- if ( Object . keys ( config ) . length === 0 ) { // No launch.json in current workspace.
83
- // VSCode will create a launch.json automatically if no launch.json yet.
82
+
83
+ // trigger build workspace
84
+ try {
85
+ const buildResult = await vscode . commands . executeCommand ( commands . JAVA_BUILD_WORKSPACE ) ;
86
+ console . log ( buildResult ) ;
87
+ } catch ( err ) {
88
+ vscode . window . showErrorMessage ( "Build failed, please fix build error first." ) ;
84
89
return config ;
85
- } else if ( config . request === "launch" ) {
90
+ }
91
+
92
+ if ( Object . keys ( config ) . length === 0 ) { // No launch.json in current workspace.
93
+ // Generate config in memory for files without project.
94
+ config . type = "java" ;
95
+ config . name = "Java Debug" ;
96
+ config . request = "launch" ;
97
+ }
98
+ if ( config . request === "launch" ) {
86
99
if ( ! config . mainClass ) {
87
100
const res = < any [ ] > ( await resolveMainClass ( ) ) ;
88
101
if ( res . length === 0 ) {
You can’t perform that action at this time.
0 commit comments