September 16th, 2019

Java on Visual Studio Code September Update

Xiaokai He
Senior Program Manager

Welcome to the September update of Java on Visual Studio Code!

There’re a lot we’ve been working on during the summer which we’d like to share with you now. You will see new refactoring and code action features such as move member and class, live linting as well as improvements for Debugger, Test Runner and Maven. We’ve also improved getting started experience with our new Pack release.

Refactoring and Code Actions

Move refactoring support

The Move refactoring lets you move packages and classes between the source roots of a project, class members to other classes and inner classes to upper hierarchy levels.

For example, you can perform the move refactoring on static method if it is used more in another class than in its own class.

You can also move a class to another package.

And move inner class to new a new file.

Other new code actions

A couple of other code actions and quick fixes are also included in the latest release

  1. Invert local variable lets you change the sense of a Boolean variable to the opposite one.
  2. Convert lambda to anonymous class (as we already support Convert to lambda expression).
  3. Create unresolved types which covers create simple class/enum/interface/annotation in various scenarios.

Linting and Checkstyle

We now support Live Linting and batch check for Java through Checkstyle extension so you no longer need to save the file one by one to update the check result. 

See live linting in action.

And batch check is now also available.

Other improvements in Checkstyle extension include

  1. Open problems panel when click the status icon in the status bar
  2. Automatically detect potential Checkstyle configuration files when using command to set the configuration

Debugger

One of the changes we’ve recently made is to use integrated terminal as default debug console. With this change, you no longer need to make specific configuration to allow the console to accept your input. The only drawback of this change is the integrated terminal doesn’t support expression evaluation. In order to use this feature, you would now need to change the console to use the Internal Console in launch.json.

"console": "internalConsole"
If you’d like to use that setting each time you launch a Java program, you can configure it as a global user setting with java.debug.settings.console.
In order to make run and debug even easier, another change we’ve made is to add menu entries to Run and Debug a Java application when you right click a Java file in file explorer or opened editor.

Test Runner

More JUnit 5 annotations are now supported by VS Code Java Test Runner.

Support JUnit 5 meta-annotations and composed annotations.

Support JUnit 5 @TestTemplate.

Getting Started Experience

For developers new to Java or new to VS Code, we’re now providing a refreshed Getting Started experience. Once you’ve installed the Java Extension Pack, you can use the command Java: Getting Started to get the quick start guide.

The new Getting Started view provides a quick start guide as well as tips for code editing and debugging. It also has an FAQ to answer some of the most asked questions. We plan to add more section to it in future.

One of the other hurdle for new Java developer is to get the JDK right. For that, we’ve also upgraded our Configure Java Runtime page which now shows the JDK configuration we detect with priority order and allow you to jump to the setting by a simple click. If a working JDK configuration is not detected, this page will be presented automatically, otherwise you can also use the command Java: Configure Java Runtime to get there.

With those new features, we’ve also released our new version of VS Code Installer for Java. You can try it at https://aka.ms/vscode-java-installer-win with improved downloading and installation experience.

External contributions

As VS Code becomes popular among Java developers, we’re getting more and more issues reported. They’re very helpful and please keep them coming! In addition, we’d like to express our gratitude for those from the community who spend more time with us to make the product even better.

  • Contribution from pi1024e: User face change: say “Do not show again” instead of “Not show again”. https://github.com/microsoft/vscode-java-debug/pull/630
  • Contribution from Christian Lutz thccorni: Typo ‘gourpId’ in hoverProvider. https://github.com/microsoft/vscode-maven/issues/368

There’re also a few pull requests from community currently under review. We’d like to thank all of you to help us build better tool for the Java community.

Sign up

If you’d like to follow the latest of Java on VS Code, please provide your email with us using the form below. We will send out updates and tips every couple weeks and invite you to test our unreleased feature and provide feedback early on.

Try it out

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

Author

Xiaokai He
Senior Program Manager

Xiaokai is the program manager working on Java developer tools and services at Microsoft. He’s currently focusing on making Visual Studio Code great for Java developers, as well as supporting Java in various of cloud services in Azure.

0 comments

Discussion are closed.