Hi everyone, welcome to the April update of Visual Studio Code Java.
This time we are bringing you many exciting updates regarding our fundamental experience improvement including Java 18 support, inlay hints for parameter names, new language server status UX, lambda expression support in debugging and so on.
Let's get into it.
Microsoft JDConf
Before we start our update, we want to share an exciting news: Microsoft JDConf is coming up! Join us for the second JDConf event on May 4 -- 5, 2022.
It is a virtual, Java focused conference where developers can come together to share interesting topics and stay engaged.
Our goal with this event is to highlight external speakers and showcase the great work that's going on across the Java community. You can get more information and register via this link:
Java 18 Support
We have always been targeting to support the latest Java technology.
With Java 18 reaching General Availability in March this year, we have enabled the support for Java 18 in our latest version as well.
This means you can now use Java 18 in your projects!
Support Inlay Hints for Parameter Names
Have you ever wondered about which parameter you are filling for in some unfamiliar methods? Don't worry, Inlay Hints is here to help you.
In our latest release, we have enabled this feature for Java projects.
Once enabled, Visual Studio Code will show a hint on the parameter name in the method signature, and there are three modes of this feature.
- none (Disable parameter name hints)
- literals (Enable parameter name hints only for literal arguments) (Default)
- all (Enable parameter name hints for literal and non-literal arguments)
You can change this setting at any time by going to the "inlay" setting under Java
Here is a demo of the feature in action:
New Java Language Server Status UX
Previously, there are multiple items on the status bar to show the current state of the Java language server, this can make the UX crowded and confusing sometimes.
Since version 1.65, Visual Studio Code has finalized its new Language Status Item APIs.
In our latest release, we not only adopted the new API, but also made some minor adjustments.
If you update to the latest version of Visual Studio Code and Extension Pack for Java, you will see the language server items have been merged into a unified item, not only making it more concise, but also providing more actions for developers to access from a single place.
Here is a demo:
As you can see from the demo above, currently the language status item provides the following information and action:
| Information | Click Action |
| Build Status | Detailed build information in the terminal |
| Build file (Whether a build configuration exists or not) | Navigate to the actual Maven or Gradle build configuration file |
| Project JDK information | Configure Java Runtime |
If there is an issue or error, you will see an indicator on the status icon and you can click on "Show problems" to reveal the error details.
We hope this improvement will provide better user experience about the state of the Java language server and please share your feedback with us so we can continue to improve this area.
Code action to extract lambda body to method
As a minor feature update, we have also added a code action (from Quick Fix) to allow developers to easily extract lambda body to a method. Here is a quick demo:
Lambda expression evaluation support in debugging
Lastly, we wanted to provide an update on lambda expression support in debugging. Previously, there was an issue that prevents developer from properly evaluating variables inside lambda expressions when debugging. In our latest release, we have fixed this issue.
Here is a quick demo of evaluating a variable from enclosing methods when using lambda in a chain call:
For complete list of supported case, please visit the original issue.
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 protected]
Resources
Here is a list of links that are helpful to learn Java on Visual Studio Code.
- Learn more about Java on Visual Studio Code.