Java on Visual Studio Code November Update

Xiaokai He

Welcome to the November update of Java on Visual Studio Code. Starting this month, we’re moving to a new home called Java at Microsoft, where you can find not only updates about Java on Visual Studio Code, but also other news and insights for Java development with other Microsoft tools, Azure services and OpenJDK. You can subscribe this blog by following @JavaAtMicrosoft.

In this update, we’d like to share some improvements we’ve made for code editing experience, more code actions, Java 13 support for Gradle projects and new features in Test Runner and Checkstyle extensions.

Code Editing

Provide better symbol details for the completion proposal

Originally, we only show javadoc for the auto completion proposal, with a simple header. To provide more detailed information and help you choose the right item, we’re now adding more detailed symbol info to the header, and hopefully helps you find the right choice faster.

Compare the previous and new information available for field

Method

Type

Package

Report unused code as unnecessary

We’ve added faded effect to unused code. So now it’s easier for you to spot them.

Code actions

Add ‘final’ modifier where possible

In Java, there is a practice of declaring every variable (local or class), parameter final if they really are. If you like to apply this to you code, you will find this code action useful.

Remove unnecessary cast

This code action will remove unnecessary cast in your code. (Note: the associated compiler warnings is not enabled by default. To enable this feature, you can manually append the compiler warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning to the file .settings/org.eclipse.jdt.core.prefs)

Other improvements

  1. Support Java 13 for Gradle project. Gradle 6.x projects with Java 13 are now supported! We’ve also upgraded embedded maven version to 3.6.2 as well.
  2. Expose Invert Condition code action which automatically find the boolean expression around your caret so you don’t need to select the entire expression to trigger it.
  3. Add text selection support in code snippet so after inserting certain code snippet, VS Code will select/highlight certain code where you will likely to take action thereafter.
  4. Java Test Runner now supports module path for your modular Java project. It also added a new ‘CollapseAll’ button for you to easily collapse your test cases in test explorer.
  5. Checkstyle for Java added support for custom checkstyle modules. Now you can set any 3rd-party modules for checkstyle using its path. For example, after using the below configuration, you can add <module name="SingleBreakOrContinueCheck"/> or <module name="com.github.sevntu.checkstyle.checks.naming.SingleBreakOrContinueCheck"/> to checkstyle.xml to leverage those checks.
"java.checkstyle.modules": [
    "${workspaceFolder}/src/main/resources/sevntu-checks-1.35.0.jar"
]

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.

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Wilfrans . 0

    Referencing to:

    Evolution of Visual Studio Code Java Ecosystem
    https://www.youtube.com/watch?v=AEWHTk_zCsQ

    I think it’s great to do java programming on visual studio code, because java is still mature enough and relevant language these days, despite of all the naysayers talking crap about java, things like “java is dead”, “don’t learn java, because is too old, ugly and verbose”, “if you go java, you are wasting your time”, etc.

    I wish to thank to Xiaokai He and Team, for delivering us such amazing tools for the java community, as well to the Eclipse Foundation for sharing this conference. Many thanks to you all.

    Keep up the good work!

Feedback usabilla icon