Welcome to the June update of Java on Visual Studio Code!
Earlier this month, we shared our new Java Installer for Visual Studio Code, which aims to help new Java developers to get their environment ready and start coding in just a few clicks. In this update, we’d like to share a couple new features and enhancements delivered during last few weeks.
More code actions
Developers need refactoring and code actions to achieve high productivity, so we’re bringing more of those features to you.
Enhanced “Generate getters and setters”
In addition to bulk generate getters and setters for all member variables, if the class has more than one field, the source action will also prompt a quick pick box which allows you to select the target fields to generate the accessor methods.
The source action is also aware of the java.codeGeneration.generateComments preference and will use it to decide whether to generate comments for getter and setter methods.
Generate Delegate Methods
This new code action enables generating delegate methods.
Generate Constructor
This source action helps adding constructor from super class.
Assign parameter to new field
This source action assigns parameter to new field for unused constructor parameter(s).
Performance improvements
A set of changes have been made to further improve performance of Java in Visual Studio Code, including a fix for I/O issue on Windows platform, reducing memory footprint for large projects with deep modules and batch project imports. VS Code is a lightweight editor and we’d like to make sure it still feels just like an editor when despite more and more features being added to it.
Debugger updates
Debugging is the most frequent used feature second only to code editing. We’d like you to enjoy debugging Java in Visual Studio Code.
Show more meaningful value in variable window and hover tool-tip
We’re now providing additional detailed information for variables during debug
- For the classes that override ‘toString‘ method, show toString() details.
- For Collection and Map classes, show an additional size=x details.
- For Entry, show key:value details
New HCR button
To better expose the hot code replace feature and let you control it more explicitly, we’ve added a new button to the toolbar and provided a new debug setting `java.debug.settings.hotCodeReplace` to allow you control how to trigger HCR. Default to `manual`.
- manual – Click the toolbar to apply the change to running app
- auto – Automatically apply the changes after compilation. This is the old behavior.
- never – Never apply the changes
See HCR in action
Global setting for selecting debug console
While VS Code offers a powerful Debug Console with REPL (Read-Eval-Print Loop) functionality, one major restriction of it is it doesn’t accept input. For those programs which need to take console input, developers need to specify to use integratedTerminal instead of internalConsole in launch.json.
"console": "integratedTerminal"
However, this is not convenient if you need to do it repeatedly. Now we’re introducing a global setting, java.debug.settings.console. you can use this setting to configure the default debug console so you don’t need to change the launch.json every time.
"java.debug.settings.console": "integratedTerminal"
Other updates
Maven
2 new configs are now available for Maven extension
- pomfile.globPattern – specified how the extension search for POM file.
- pomfile.autoUpdateEffectivePOM – specifies whether to update Effective-POM automatically.
Test Runner
In recent releases, we’ve added support for a couple additional JUnit5 annotations, such as @Nested and @TestFactory. Test runner will also automatically show the test report after execution now.
Sign up
If you’d like to follow the latest of Java on VS Code, please provide your email with us using the form below. We will send out updates and tips every couple weeks and invite you to test our unreleased feature and provide feedback early on.
Try it out
Please don’t hesitate to give it a try! Your feedback and suggestions are very important to us and will help shape our product in future.
- Learn more about Java on Visual Studio Code.
- Explore our step by step Java Tutorials on Visual Studio Code.
0 comments