Java on Visual Studio Code Update – March 2020

Xiaokai He

Welcome back to the March update of Java on Visual Studio Code in 2020. Please be safe and stay healthy during the outbreak of COVID-19.

In this update, we will show you the performance improvements just released as well as currently under development. You will see Syntax Mode, the newly polished experience for standalone Java files. We’d also like to introduce you to the newly released SonarLint extension which helps you detect code quality and security issues on the fly. On to the update.

Performance Improvements

As a lightweight code editor, we’re striving to make VS Code really fast when developing Java. One important aspect of the editor performance is resolving a project. As a Java developer, lots of time are spent during downloading and resolving Maven dependencies. In the most recent release, we’ve enabled parallel download of jars for Maven projects, and the effect is quite evident. We tested it using the famous spring-petclinic project, the time for fully resolving the project reduced from around 10 minutes to 7 minutes 20 seconds. This improvement is part of m2e project so it will also enable the same improvement for Eclipse and other tools using the same component soon. We’re actively looking at more scenarios to further improve the performance. Please stay tuned.

Say Hello to Syntax Mode

Bye to the infamous “Classpath is incomplete” warning. A lot of developers complained about this rather unhelpful warning, so in this release, we decided to provide a dedicated mode for reading non-project Java code.

Image Classpathisincomplete

Here to introduce Syntax Mode, which works best for any Java source file/folder that does not involve a project system. With this, you’ll be able to read code more efficiently with the help of Code Navigation and Outline features. Syntax errors are also reported so you can fix them right away.

The good thing about this capability is that you won’t even aware its existence. But there is definitely a way to configure it. Go to PROBLEMS view, and look for the warning “File xxx is non-project file, only syntax errors are reported”, which means you are in Syntax Mode. If you want to see all the type errors and get full support, right click on this warning and the switch is in the context menu. See screenshots below.

Image enablesemantic

Here’s how to turn it back to Syntax Mode.

Image syntaxonly

SonarLint supports Java for VS Code

SonarLint is an popular IDE extension that helps you detect bugs and vulnerabilities as you write code, which is widely used among Java developers. It’s available in many IDEs and now you can also use it with VS Code. This is a great collaboration between team members from SonarLint, Red Hat and Microsoft. The extension runs in the background and highlights code that poses a quality or security concern.

Image 1 Bug

We’d like to welcome more developers to join us and improve Java development experience in VS Code together! If you have any idea, please submit an issue to Java Extension Pack.

More enhancements

The latest updates also brings a lot of other enhancements for Java experience in Visual Studio Code.

  1. Allow renaming of lambda parameters.
  2. Enable VS Code Java run from read-only location.
  3. Optimize for better memory footprint management.
  4. Report progress of build workspace action to client.

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.

4 comments

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

  • Gabriel MESQUIDA-MASANA 0

    How can we deactivate this new Syntax Mode for good without having to do it manually every time that we create (o review) a file that is not a project? Thanks a lot.

    • Rong LiMicrosoft employee 0

      To always start the Java language server in Full Mode, please set the setting “java.server.launchMode” to “Standard”.

      While some of the users know how .classpath files can be customized, many others don’t and kept complaining about the overwhelming red squiggles. This is why we develop Syntax Mode in the first place. Syntax Mode also improves startup performance by enabling code navigation without fully downloading the dependencies from the internet.

      I hope the setting helps you in this specific scenario. And please let us know if you have further issues.

  • Rohan Dutta 0

    I’m quite a beginner in Java & don’t want the “Sum.java is a non-project file, only syntax errors are reportedJava(16)” warning, just like it was before. Please Help!

    • Rong LiMicrosoft employee 0

      You are using the standalone file feature. To make it work, open the containing folder of Sum.java instead of the file itself. Please have a try.

Feedback usabilla icon