Yang Yaojin from Microsoft VS Code Java Team

Welcome to this VS Code Java update. Another busy and productive month. The Java debugger and Java test extensions have gained new functionality. Before we get into the details, we want to give Microsoft Build 2021 a heads up. This time you’ll be hearing more about Java and VS Code, so join us.

Debugging: Inline Values and Customized Variables View

With the new debugger extension API, the Java debugger extension can now display variable values inline in the editor when stepping through source code.

You can enable this function by using the following methods: Choose Files > Preferences > Settings menu, search for debug.inlineValues in the Settings view, and then select the option.

The Java debugger now also supports custom variable views. You can right-click the view to bring up custom menus.

The VS Code 1.56 Release Party demonstrates both of these features. See more details here.

Testing: Generating method templates automatically

Automatically generating test method templates and importing test packages is a convenient feature to improve coding efficiency. Starting in April, you can generate method templates directly from test files. In May, we’ll also add support for generation from source files.

To generate a test method template, open or create a test file in the project’s tests folder, right-click the file editor to invoke the context menu, and select “Source Action…” in turn. “Generate and Test…” , and finally select the method to generate.

Note: In order to generate from test files, you need to add test dependencies to your project.

enhancements

  • Support for Java 16.
  • Improved the experience of creating Maven projects. Now, when the creation is complete, you will be prompted to open the project you created.

For more information

Please don’t hesitate to give it a try! Your feedback and suggestions are very important to us and will help shape our products in the future.

  • Learn more about Java on Visual Studio Code.
  • Step by step explore the Java tutorial for Visual Studio Code.