Yang Yaojin from Microsoft VS Code Java Team

Welcome to the May VS Code for Java update. This time, we’ll share the Java formatting editor and other cool features with you. Let’s go.

Java formatting Settings

Today, changing Java formatting Settings on VS Code requires you to browse through an XML file containing hundreds of options, change the file, and apply the changes to your project without being able to preview the changes. This process is cumbersome and error prone. To solve this problem, we introduced the Java Formatter Settings Editor. The editor classifies the formatting options and allows you to preview the changes.

To launch the editor, click Ctrl+Shift+P to open the Command Palette, then type “Java: Open Java Formatter Settings with Preview” on the Palette, and run the command. After making the changes, right-click the editor and select Format Document, or type Format Document on the Command Panel and run the command to apply the changes to your project.

Generate tests from source files

In the April update, we introduced the automatic generation of test method templates from test files. In May, we developed this feature further, and now you can generate test files and test method templates directly from source files. You can right-click on the Source file editing page and select “Source Action…” “And then select” Generate Test…” To generate.


  • Set up your Classpaths and ModulePaths parameters in the launch.json file. Parameter supports the following predefined values:

-$Auto — Automatically calculates the current item’s classpaths or modulepaths. This is the default option.

-$Runtime — Add a Runtime range of Classpaths or ModulePaths.

-$Test — Add Test ranges to your Classpaths or ModulePaths.

-! <path> — Exclude path from classpaths or modulepaths.

  • Jupyter Notebook is an open source project that allows you to create and share documents containing real-time code, equations, visualization, and narrative text. It is very popular for learning programming languages, data analysis and machine learning. If you are interested in using it for Java in VS Code, follow the instructions.

For more information

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

  • Learn more about Java on Visual Studio Code.
  • Explore the Java tutorial on Visual Studio Code step by step.