Java on Visual Studio Code Update – September 2022
Hi everyone, welcome to the September update of Visual Studio Code Java. We have tons of exciting new features this time, and there are improvements in many areas such as project import, Spring support, remote debugging and unit testing, so let’s get started!
Protobuf (Protocol Buffer) project support
Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. Previously, if a Java project involves protobuf, our Java extensions won’t work very well and you will be likely to encounter lots of unrecognized classes. This is because our extensions couldn’t detect the proto file properly, therefore required code is not generated and the generated code won’t found.
In our latest release, we have added support for “protobuf” projects. If a “.protobuf” file is detected, you will see a prompt from Visual Studio Code asking if you want to generate Java source code out of your proto files. When clicked yes, our extensions will generate the code and all the “unrecognized type” errors will go away! Here is a quick demo to show this feature.
Improvement of Android project import
Apart from protobuf projects, we have also improved the support for Android projects. Previously, the import for Android projects would silently fail and most of the core Java features won’t work. However, we have fixed this issue and now you can import Android projects without problems. After import is done, you will be able to use all the language features normally. Here is a quick demo.
To use this feature, you will need to configure java.jdt.ls.androidSupport.enabled. Here’s a screenshot of this setting:
Spring Boot Actuator Integration in Spring Boot Dashboard
Starting this year, we have added tons of features to the Spring dashboard in order to bring better visualization experience to Spring developers. One of the popular features in the dashboard is show live information of the running Spring application. However, for this feature to be enabled, the application needs to have Spring Boot Actuator enabled.
To provide a more smooth experience for developer, we have added a feature to auto-detect the Spring Boot Actuator dependency in your Spring project. If it is not detected, we will show a hint to let you know that live information needs Spring Boot Actuator and even add it for you. If you choose not to add it, then only static information will be shown. Here’s a quick demo.
Improved Spring Boot Project Creation
There is also improvement in Spring Boot project creation experience. During the workflow, we have added external links to Spring documentation and code samples. If you see a book icon, you can click the icon and browse related documentation for more information regarding your project components.
Major remote debugging performance improvement in high network latency
Good news for cloud-native developers, there has been significant remote debugging performance boost when network latency is high. In some cases, the latency can be reduced from 2x to 45x. For those who are interested, the detailed analysis can be found in this GitHub issue including the technical background. We will also author a more complete blog to talk about this improvement. Please note this is still an experimental feature, so it is automatically enabled for Insiders users. For stable version users, you can set `java.debug.settings.jdwp.async` to true. Here is a demo that showcases the experience.
Testing – Filtering tests using JUnit 5 tags
Lastly, we have added a feature to improve unit testing. In our latest version, we have added support for JUnit 5 tags so you can filter out certain tests during execution. The way to use this to add the tag information in settings.json under “filters”. More information on how to customize test configuration can be found on this tutorial. Here is quick demo to show how to do this.
Install Extension Pack for Java
To use all features mentioned above, please download and install Extension Pack for Java on Visual Studio Code.
Feedback and suggestions
As always, your feedback and suggestions are very important to us and will help shape our product in future. There are several ways to give us feedback
- Leave your comment on this blog post
- Open an issue on our GitHub Issues page
- Send an email to: email@example.com
Here is a list of links that are helpful to learn Java on Visual Studio Code.
- Learn more about Java on Visual Studio Code.