Java on Visual Studio Code Update – January 2024

Nick Zhu

Hi everyone, welcome to the first update for Visual Studio Code for Java of 2024! We hope everyone had a refreshing break. In this blog we have some exciting updates for the new Test Coverage UX as well as reliability and general user experience updates, so let’s get started!

Update of Java 21 Feature Support

As shared in our roadmap blog post last December, integrating JDK 21 support is a key focus in enhancing fundamental experience. Following its release, many efforts have been done to supports its features. We’re pleased to share our progress. Here’s a summary of the features we currently support and those still in progress.

Current Status (List referenced from here)

430: String Templates (Preview) Supported
431: Sequenced Collections Supported
439: Generational ZGC Supported
440: Record Patterns Supported
441: Pattern Matching for switch Supported
442: Foreign Function & Memory API (Third Preview) Supported
443: Unnamed Patterns and Variables (Preview) Work In Progress
444: Virtual Threads Supported
445: Unnamed Classes and Instance Main Methods (Preview) Work In Progress
446: Scoped Values (Preview) Supported
448: Vector API (Sixth Incubator) Supported
449: Deprecate the Windows 32-bit x86 Port for Removal Supported
451: Prepare to Disallow the Dynamic Loading of Agents Supported
452: Key Encapsulation Mechanism API Supported
453: Structured Concurrency (Preview) Supported

We will continue to work on the remaining features and share an update again soon. For users who currently do not need features that are work in progress, you can already use JDK 21 in Visual Studio Code Java.

Test Coverage UX Updates

In our previous blog, we shared the new Test Coverage feature that can already be used in Visual Studio Code Insider version. However, the previous feature requires the users to select “Execute Using Profile” in order to see the coverage results, which is not intuitive. In addition, there is no coverage visualization in the editor area about your code on which is covered or not. In our latest pre-release version, we have made improvements for both of these issues. Now you can get to test coverage by just clicking the “Run Test With Coverage” button right next to “Debug Test” (Please note the icon is still a placeholder and will be changed). Here’s a demo.

Image coverage

In addition, you can see if the code is already covered by the test in the editor area.

Test Coverage Visualization

To use the new Test Coverage feature, please make sure you have both Visual Studio Code Insiders and Pre-release version of Extension Pack for Java installed.

Java Language Server Status UX Improvement

Another UX improvement is about the Java Language Server status. Previously, users see the {} status icon only if current opened file is Java file. This is inconvenient for many users as Java projects might contain other types of files, especially for users who work on polyglot projects. In our latest version, we have made an improvement for the status icon. The icon is now parallel to {} for an easier access. In addition, now as long as Java extension is activated, the icon will display the status of the Java Language Server, regardless of the current opened file. The pictures below demonstrate the difference.

Before 

Java Language Server Icon Before

After

Java Language Server After

Fix for “Editor Content Out of Sync” Issue

Reliability has always been our top priority, and recently we discovered an issue that causes editor content to be out of sync with the Java Language Server, which will in turn report false errors. This has been reported by users in our survey as well as on GitHub.

We have already released a fix for this issue. After the release, we have observed in a notable reduction of occurrences. If you encounter any further problems, please do not hesitate to create an issue here.

Install Extension Pack for Java

To use all features mentioned above, please download and install Extension Pack for Java on Visual Studio Code.

Extension pack for Java

If you are a Spring developer working on a Spring Boot application, you can also download the Spring Boot Extension Pack for specialized Spring experience.

Spring boot extension pack

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: vscjfeedback@microsoft.com

Resources

Here is a list of links that are helpful to learn Java on Visual Studio Code.

0 comments

Leave a comment

Feedback usabilla icon