2
头图

Hi everyone, and welcome to the April Update for Visual Studio Code Java. This time we bring you many exciting updates to the underlying development experience, including Java 18 support, embedded hints for parameter names, new Java language server state interactions, better lambda expression support, and more. let's start!

Microsoft JDConf

Before our update, we would like to share an exciting news: Microsoft JDConf is coming! Actively register for the second JDConf event on May 4-5, 2022. This is a Java-themed virtual conference where developers can come together to share Java-related topics. Our goal for this event is to highlight and showcase the outstanding work being done by the entire Java community. If you are interested, you can get more information and register via this link: https://aka.ms/jdconf

Java 18 support

We are always working to support the latest Java technologies. With the general release of Java 18 GA in March of this year, we have also enabled support for Java 18 in the latest release. This means you can now use Java 18 in your projects!

Inlay Hint support for parameter names

When writing code, do you sometimes wonder which parameter you are filling in? In some functions that take literals as arguments, do you want to know what value you supply? Good news is coming! Inlay Hints will solve these problems for you! In our latest release, we enabled this feature for Java projects. When enabled, Visual Studio Code will prompt for parameter names in method signatures in three modes.

  • None (disables parameter name hinting)
  • literal (parameter name hinting is enabled for literal parameters only) (default)
  • all (enable parameter name hinting for all parameters)

You can change this at any time by going to the " inlay " settings under Java

Here's a demo of the feature:

New Java Language Server State Interaction Method

Previously, there were multiple items on the status bar to show the current state of the Java language server, which sometimes made the interface crowded and cluttered. Visual Studio Code has completed its new Language Status Item API since version 1.65. In our latest release, we not only adopted the new API, but also made some small tweaks. If you update to the latest version of the Visual Studio Code and Java plugin package , you'll see that the various language server states have been merged into one unified item, which is not only more concise, but also provides developers with more action, and the ability to do things from a single place to do more. Here is a demo:

As can be seen from the above demonstration, the portal currently provides the following information and actions:

If there is a problem or error, you will see an indicator on the status icon and you can click "Show Problem" to display the error details.

We hope this improvement will provide a better user experience for the state of the Java language server, please share your feedback with us so we can continue to improve this area.

Code action to extract lambda body to function

As a minor feature update, we've also added a code action (from Quick Fix) to allow developers to easily extract lambda bodies into functions. Here's a quick demo:

Support for Lambda Expressions in Debugging

Finally, we'd like to provide some updates to support for lambda expressions in debugging. In a previous issue on GitHub, a user found that when debugging, the plugin did not correctly evaluate the variables in the lambda expression. In our latest version, we have fixed this issue. Here's a quick demonstration of evaluating variables when using lambdas in chained calls:

For a complete list of all support cases, please visit the original Issue .

feedback and suggestions

There will be many exciting updates to Java on Visual Studio Code in 2022, and as always, your feedback and suggestions are very important to us and will help shape our future products. There are several ways to leave us feedback

resource

The following links and resources can help you better understand Java on Visual Studio Code

Java in VS Code Tutorial

Pay attention to Microsoft China MSDN public account to learn more


微软技术栈
423 声望997 粉丝

微软技术生态官方平台。予力众生,成就不凡!微软致力于用技术改变世界,助力企业实现数字化转型。