Java on Visual Studio Code Update – December 2023

Nick Zhu

Hi everyone, welcome to the December update for Visual Studio Code for Java! We wish everyone a Merry Christmas and Happy New Year! In this blog we have tons of exciting new features including test coverage, UX updates as well as Spring Boot updates. Let’s get started!

Test with Coverage in Visual Studio Code Insiders

Test coverage is a metric which shows how much our test cases are covering the software code when we run those test cases. In previous versions, developers are not able to see the test coverage when they run tests in Extension Pack for Java, and test coverage is probably one of the most wanted features from our user feedback.

We have great news to share! With the recent progress from the GitHub Issue here, our team has adopted the latest Test Coverage API in Extension Pack for Java. Developers can already see the coverage results running Java tests in the Insiders version of Visual Studio Code. To get the coverage results, please select “Execute Using Profile” when running tests, then select “Run Tests with Coverage“, and you will be able to see the “Test Coverage” Panel in the Test Explorer.

Note that to use this new feature, please make sure you have both Insiders version of Visual Studio Code and latest version of Extension Pack for Java. Here’s a demo for this feature.

Test Coverage in Insiders

Test Coverage in Insiders

Group Java Extension Settings by category

As more features are added into the Java extensions in VS Code, more settings are also created to control relevant behaviors. Previously all our Java related settings are grouped together, which will make it really hard to find a specific setting developer wants. In our latest release, we have improved this UX so that the settings are grouped by categories and usage. This will make developers find the settings in a much more efficient way. Here’s a screenshot of the current experience.

Image settings
Group settings by categories

Improved “Add New Java File” Experience

We received lots of feedback from our users that creating Java classes / interface / other types in our extensions is not intuitive enough.  In previous versions users need to create a Java file first, then select the type from list from suggested types, this workflow is not optimal from many developers who are used to other Java IDEs. In our latest version, we have changed the workflow so that when user creates a Java file, our Java extension will show a list of Java types directly, and the user can enter the name of file. When the workflow is completed, the user will already have a complete file that’s ready. Here’s a demo for this feature.

Create new file new experience
Create new file new experience

Better multi-module project import

Imagine if you have a multi-module project and you import this project into Visual Studio Code. Our previous version of extension will automatically import everything into the workspace. If you have a lot of modules, this will take significant time which can be painful. Now with our new feature this is no longer the case. When the setting “java.import.projectSelection” is set to “manual”, the developer can import the project into the workspace and then select which sub-projects to be imported, therefore skipping the modules that don’t need to be imported, greatly reducing the overall project import time. Please see the demo for this feature below.

Please note that currently only Maven projects can be partially imported.

Multi module project import

Major Spring Boot Extension Updates

In addition to the core Java extension updates above, there are also some exciting new features for the Spring Tools extension (included in the Spring Boot Extension Pack).

Migrate your projects to Spring Boot 3.2

The latest release of the Spring Tools includes support for automatically upgrading your Spring projects to Spring Boot 3.2, using the latest recipes from OpenRewrite behind the scenes. This complements the existing upgrade support move projects from Spring Boot 2.x to Spring Boot 3.0 and beyond.

Improved code completion for generating request mapping methods

In addition, the latest release Spring Tools extension feature nicely improved code completion templates to quickly write new request mapping methods in controller classes. The new completions for request mappings show up immediately after typing `@` in a controller class, making them a lot more visible and useful right at your fingertips. Here’s a demo.

Improved request mapping completion

Property completion multiple times faster

The code completion in application.properties or application.yml files works dramatically faster now, the first invocation is even up to 10x faster than in previous releases.

Integrated completely new validation engine

Already introduced in September, the new validation engine analyzes and indexes your projects a lot faster than before. Spring specific validations and quick fixes show up a lot faster now while using significantly less memory in the background at the same time.

Additional performance improvements

There are a lot of additional performance improvements that went into the recent versions of the Spring Tools, making them significantly faster while using less CPU cycles and less memory at the same time. The Spring Tools feel a lot snappier and lightweight compared to previous versions, especially compared to versions prior to Sep 2023.

Looking Forward

As we shared in our roadmap blog post last time, there are many exciting things to come in 2024, and let’s continue to make Java experience great on Visual Studio Code!

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

Discussion is closed.

Feedback usabilla icon