August 1st, 2024

Java on Visual Studio Code Update – July 2024

Nick Zhu
Senior Program Manager

Hi everyone, welcome to the July update for Visual Studio Code for Java! This blog will cover the latest Gradle enhancements, user experience improvements and new Spring features, so let’s get started!

Gradle enhancements

HCR Support for Gradle Build Server

HCR (Hot Code Replace) is an advanced feature that debugger supports in VS Code Java. It allows you to start a debugging session and change a Java file without restart, and the debugger will replace the code in the running JVM. Previously, this feature does not support Build Server for Gradle which is used in Gradle Extension. With our recent update, we have implemented this support and now you’re able to utilize HCR in your debugging session. Here’s a demo of this feature.

Gradle BSP HCR

To learn more details about HCR, visit this link.

Delegate Test to Gradle

In our latest release, we have added the support of “Delegate test to Gradle”, This allows you to execute tests in VS Code Java via the Gradle test runner, ensuring alignment with command line tools and leveraging the advantages of Gradle tooling. To use this feature, simply select “Delegate Test to Gradle” as the default test profile before you run the tests. Here’s a demo on how to use it.

In this release, we only support “Run Tests”, but we also plan to support “Debug Tests” very soon, so please stay tuned.

Gradle test delegation

To use Gradle features above, please install both Extension Pack for Java and Gradle for Java extension.

User experience improvements

Create Java Package in File Explorer

Creating Java package is a task Java developers perform frequently, and based on user feedback for easier access, we’ve added this operation into the right click context menu into the file explorer. To access it, the user just needs to right click on a folder in the File Explorer, and find the “Create Java Package” along with other common Java task there. Below is a screenshot for reference. 

Create Java package

Accessing Help Center from Status Bar

We’ve created a help center for Java developers, particularly newcomers to VS Code, offering helpful resources in one location. Before, it was somewhat concealed and not readily accessible. In the latest release, we’ve made it easily reachable by adding entry to the status bar. Here’s a demo on how to access the Help Center from the status bar. 

Help Center

Spring Feature Updates

There are several exciting new Spring features. To use the features below, please install Spring Boot Extension Pack.

SpEL syntax highlighting and validation

Like JPQL syntax highlighting, SpEL expressions inside of annotations (like @Value) or inside of queries now also have syntax highlighting and basic validation.

Image thumbnail spel syntax highlighting

Content assist and find reference support for Spring Annotations

Working with Spring annotations in Java source code gets faster and easier with every release. The latest Spring Boot Tools add advanced support for:

  • @Profile (auto-completion and find references for profile names)
  • @Qualifier (auto-completion, go to definition, and find references for qualifier values)
  • @DependsOn (auto-completion, go to definition for bean names)
  • @Resource (auto-completion and go to definition for bean names)
  • @Value (auto-completion and go to definition for classpath: resources)

Here’s demo for content-assist and find references.

Content assist

Image profile content assist

Find references

Image profile find references

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.

Author

Nick Zhu
Senior Program Manager

Developer at heart

0 comments

Discussion are closed.