Skip to content

Commit f79664c

Browse files
Add debug/toolbar button to reload changed classes (#586)
* Add debug/toolbar button to reload changed classes Signed-off-by: Jinbo Wang <[email protected]> * Make tslint happy Signed-off-by: Jinbo Wang <[email protected]> * Show a warning when autobuild is disabled Signed-off-by: Jinbo Wang <[email protected]> * Address review comments Signed-off-by: Jinbo Wang <[email protected]>
1 parent 7af2ba9 commit f79664c

16 files changed

+120
-29
lines changed

.vscodeignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ src/**
77
tsconfig.json
88
gulpfile.js
99
.gitignore
10-
images/**
10+
images/docs/**
1111
testprojects/**
1212
TestPlan.md
1313
.github/**

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
9595
- `java.debug.settings.showQualifiedNames`: show fully qualified class names in "Variables" viewlet, defaults to `false`.
9696
- `java.debug.settings.showLogicalStructure`: show the logical structure for the Collection and Map classes in "Variables" viewlet, defaults to `true`.
9797
- `java.debug.settings.maxStringLength`: the maximum length of string displayed in "Variables" or "Debug Console" viewlet, the string longer than this length will be trimmed, defaults to `0` which means no trim is performed.
98-
- `java.debug.settings.enableHotCodeReplace`: enable hot code replace for Java code. Make sure the auto build is not disabled for [VSCode Java](https://github.com/redhat-developer/vscode-java). See the [wiki page](https://github.com/Microsoft/vscode-java-debug/wiki/Hot-Code-Replace) for more information about usages and limitations.
98+
- `java.debug.settings.hotCodeReplace`: Reload the changed Java classes during debugging, defaults to `manual`. Make sure `java.autobuild.enabled` is not disabled for [VSCode Java](https://github.com/redhat-developer/vscode-java). See the [wiki page](https://github.com/Microsoft/vscode-java-debug/wiki/Hot-Code-Replace) for more information about usages and limitations.
99+
- manual - Click the toolbar to apply the changes.
100+
- auto - Automatically apply the changes after compilation.
101+
- never - Never apply the changes.
99102
- `java.debug.settings.enableRunDebugCodeLens`: enable the code lens provider for the run and debug buttons over main entry points, defaults to `true`.
100103
- `java.debug.settings.forceBuildBeforeLaunch`: force building the workspace before launching java program, defaults to `true`.
101104

TestPlan.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,33 @@ anonymous
299299

300300
1. Open project `19.java9-app` in vscode.
301301
2. Follow gif to verify step filters feature.
302-
![stepfilter](images/33868694-673f14b0-df3f-11e7-9983-b3cff5842020.gif)
302+
![stepfilter](images/docs/33868694-673f14b0-df3f-11e7-9983-b3cff5842020.gif)
303303

304304
The new gif:
305-
![stepfilters](images/34507770-69597114-f074-11e7-8f32-027ad1d7a4fd.gif)
305+
![stepfilters](images/docs/34507770-69597114-f074-11e7-8f32-027ad1d7a4fd.gif)
306306

307307
## Hot Code Replace
308-
308+
- Manually trigger hot code replace
309309
1. Open project `24.hotCodeReplace` in vscode.
310-
2. Set breakpoints: NameProvider.java line 12; Person.java line 13
310+
2. Set breakpoints: NameProvider.java line 12; Person.java line 13.
311311
3. Press `F5` to start debug.
312-
4. The program stopped at the Person.java line 13
313-
5. Change the value of the line "old" to "new"
314-
5. Save the document to trigger HCR. Check the breakpoint will stop at line 12
315-
6. Click F10 to step over, check the value of `res` on the debug view of local variable which should be `new`
312+
4. The program stopped at the Person.java line 13.
313+
5. Change the value of the line "old" to "new", and save the document.
314+
6. Click the "Hot Code Replace" icon in the debug toolbar to trigger HCR. Check the breakpoint will stop at line 12 .
315+
7. Click F10 to step over, check the value of `res` on the debug view of local variable which should be `new`.
316+
317+
- Automatically trigger hot code replace
318+
1. Repeat step 1 ~ 4 above.
319+
2. Change `java.debug.settings.hotCodeReplace` to `auto`.
320+
3. Change the value of the line "old" to "new", and save the document.
321+
4. HCR will be automatically triggered. Check the breakpoint will stop at line 12 .
322+
5. Click F10 to step over, check the value of `res` on the debug view of local variable which should be `new`.
323+
324+
- Disable hot code replace
325+
1. Repeat step 1 ~ 4 above.
326+
2. Change `java.debug.settings.hotCodeReplace` to `never`.
327+
3. Change the value of the line "old" to "new", and save the document.
328+
4. Click F10 to step over, check the value of `res` on the debug view of local variable which should be `old`.
316329

317330
## Conditional Breakpoints
318331

@@ -342,7 +355,7 @@ public class App
342355

343356
2. set conditional breakpoint on line 13 with condition `i ==1000`, F5 and wait the breakpoint to be hit
344357

345-
![java-conditional-bp-demo](images/37269785-0ffef8e6-2607-11e8-955f-93548ad5a0ad.gif)
358+
![java-conditional-bp-demo](images/docs/37269785-0ffef8e6-2607-11e8-955f-93548ad5a0ad.gif)
346359

347360
3. verify i equals 1000 in variable window.
348361
4. F5 and wait for program to exit.
@@ -406,7 +419,7 @@ Exception in thread "main" java.lang.IllegalStateException
406419
2. Launch java debugger and continue your program.
407420
3. When the logpoint code branch is hit, it just log the message to the console and doesn't stop your program.
408421

409-
![logpoint](images/41949312-77627a40-79f3-11e8-9fd2-def4fa06e28d.gif)
422+
![logpoint](images/docs/41949312-77627a40-79f3-11e8-9fd2-def4fa06e28d.gif)
410423

411424

412425
## Start without debugging
@@ -472,7 +485,7 @@ Exception in thread "main" java.lang.IllegalStateException
472485
```
473486
4. Press F5 to verify the variables should be like this:
474487
475-
![args](images/args.PNG)
488+
![args](images/docs/args.PNG)
476489
477490
## Classpath shortener for long classpath project
478491
1. Open `longclasspath` project in VS Code.

Troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ This error indicates you are doing `Hot Code Replace`. The `Hot Code Replace` fe
4545

4646
### Try:
4747
1. Restart your application to apply the new changes. Or ignore the message, and continue to debug.
48-
2. You can disable the hot code replace feature by changing the user setting `"java.debug.settings.enableHotCodeReplace": false`.
48+
2. You can disable the hot code replace feature by changing the user setting `"java.debug.settings.hotCodeReplace": "never"`.
4949

5050
## Please specify the host name and the port of the remote debuggee in the launch.json.
5151
### Reason:
Lines changed: 13 additions & 0 deletions
Loading
File renamed without changes.

0 commit comments

Comments
 (0)