Java on Visual Studio Code Update – March 2022

Nick Zhu

Hi everyone, welcome to the March update of Visual Studio Code Java. This time we are going to bring you some recent update regarding our code completion optimization, Maven improvements and pre-release version of our Java extensions. Let’s get right into it!

More shortcuts to generate code snippets

Because our language support for Java is provided via Eclipse ™ JDT Language Server, the shortcuts to generate certain code snippets (such as System.out.println) are mostly based on Eclipse convention. For example, the shortcut for System.out.println() is sysout. However, we heard from a lot of users that they are used to shortcuts from other IDEs such as IntelliJ IDEA and would like to see shortcuts from these IDEs supported in Visual Studio Code as well. Therefore, we have added these shortcuts for common code snippets in our extensions. Here is a list of the shortcuts we support

Code template Eclipse-style shortcuts IDEA-style shortcuts
System.out.println() sysout sout
System.err.println() syserr serr
System.out.println() for current method signature systrace soutm
public static void main(String[] args) {} main psvm / main
Iterator (for loop) foreach iter

A quick demo to showcase these new shortcuts

More shortcuts

Code completion optimization for constructors (new keyword)

Regarding the code completion, one of the top issues is that when writing a constructor in VS Code, developers expect that the suggestion should be directly related to the type that is defined (for example, List<String> list = …  should prompt a List type auto-suggestion for “…” part), however, this is often not the case in the current implementation.

During the last few iterations, we have investigated this issue and made changes to improve this experience. With these new improvements, the code completion will be more aware of the type that user is creating and suggests the most relevant type for the constructors. For example, a List<String> will result in a suggestion for new ArrayList<String>. Similarly, a String[] will result in a suggestion of an array type to complete the constructor. Here is a sneak peek for this improvement:

Constructor Optimization

We are still making a few tweaks to the feature above and it will be available in the next few versions.

Earlier this year, we released our roadmap for 2022 and better code completion experience is one of our major investments. We hope to continue improving this area so please let us know if you’d like to see any other enhancements regarding code completion quality and performance.

Maven improvements

In addition to new features of code completion, we have also made a few improvements to our Maven extension.

  • Display a tooltip to show Maven POM file path 

Previously, when developers open several projects with the same name, it’s hard to distinguish which POM file the project belongs to. Also, it’s generally helpful to show the exact path of the POM file to give developers more information. Therefore, we added a minor improvement so that when developer hovers on the main node in the Maven extension view, a tooltip is shown to display the full Maven POM file path. Here is a screenshot of this improvement:

Maven POM file path

  • Code completion in the POM version now correctly replaces the version

When auto completing a Maven dependency version, previously our extension will add the the result to the existing text instead of replacing it, causing an issue in our user experience. We have fixed this issue in the recent version and now the autocompletion will correctly replace the version, and similar improvement also works for artifactId and groupId.

Maven completion

Pre-release version of extensions for Java

Since version 1.63, Visual Studio Code has supported the pre-release version of extensions so developers can opt in to try out the latest cutting edge features and provide feedback. We are excited to announce that the pre-release channel has been enabled for Gradle for Java and Maven for Java extension, and we will enable rest of the extensions in the extension pack by the end of this month. For developers who always like to get the latest bits, feel free to install the pre-release version and leave us early feedback. For those who like to use a stable version, you can always choose to use the “release version” like before

You can easily switch between pre-release and release versions by using the additional button next to the Install option in Visual Studio Code (shown in the pictures below)

Pre release


Feedback and suggestions

As always, your feedback and suggestions are very important to us and will help shape our product in future. There are several ways to give us feedback

  • Leave your comment on this blog post
  • Open an issue on our GitHub Issues page
  • Send an email to:


Here is a list of links that are helpful to learn Java on Visual Studio Code.

1 comment

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

  • Ashish Nerkar 0

    Great to know the improvements happening on VS Code for Java. I am into Devops and look into the tools used by developers in my organization. Recently, I have added auto configurations in dev setup of my organization (Siemens Software Industry), so that they could readily use Vs code for debugging existing java projects. We have quite old projects where classpaths and dependencies are handled locally and we are not using Maven or Gradle to do that. Classpaths are handled through an environment variable like –

    <classpathentry kind="var" path="ROOT/path/fileName.jar"/>

    in the .classpath files. This is not currently supported by VS Code. But, I bypassed this by providing a utility that changes the environment variable entries to absolute path in the .classpath files. This is not ideal but it does work. My request is if this environment variables could be supported by VS Code out of the box we would be able to roll out support for other java project in our organization.

Feedback usabilla icon