Java on Visual Studio Code Update – August 2020

Yaojin Yang

Yaojin

Welcome back to the August update of Java on Visual Studio Code. In this update, we will focus on performance improvements and project management. On to the update.

Performance improvements

IntelliSense (a.k.a. Code Complete)

IntelliSense is one of the most frequently used VS Code features. After carefully examined current design and implementation, we were able to identify areas for improvements. In brief, the performance of IntelliSense is highly impacted by the number of requests clients send to language server and the language server’s capability to process these requests. As a result, our improvements have been focused on cutting unnecessary client requests and optimizing language server’s processing capability. Although the improvements will take a couple of iterations, we have already seen very positive results through our latest releases in August. In our test with the latest releases, we are able to achieve over 80% performance improvement. The details of our test are:

Environment:

  • CPU: 2.9 GHz Dual-Core Intel Core i5
  • Memory: 8 GB 2133 MHz LPDDR3
  • OS: macOS Catalina 10.15.6
  • VS Code version: 1.48.2
  • Extension tested:
ExtensionJul. release versionAug. release version
Language Support for Java(TM) by Red Hat0.65.00.66.0
Java Test Runner0.24.00.24.2
Project Manager for Java0.10.20.13.0
Visual Studio IntelliCode1.2.91.2.10

Test:

In a Java file with 5000+ lines of test code, trigger IntelliSense by typing Character ‘S’, and wait till suggestion popped up. Repeat 5 times for July and August releases respectively. Each time, we measure duration between client’s request time and language server’s response time.

Results:

#1#2#3#4#5Avg.
Jul. release742067456653505150636186.4
Aug. release923412469600752631.2

Unit: ms

Workspace refreshing

For our users, it’s rather common that workspace contains non-Java project related assets. For example, working on Node project, your workspace may contain “node_modules” folder; using Git, your workspace may contain “.git” folder. If run into one of these cases, you may notice the performance of refreshing workspace is negatively impacted, because these folders are being processed, which is unnecessary. To improve, we introduced a new configuration “java.project.resourceFilters”, where you can specify folders or files that should be excluded from your workspace’s refreshing. By default, ‘node_modules’ and “.git” folders are excluded. You can find the configuration by clicking Files->Preferences->Settings menu and then search for “java.project.resourceFilters” on settings view.

Project View

In July, we introduced the project view. Our goal is to allow you accessing all project management related functions through this single view. In August, we consolidated more functions into the view.

Creating packages and classes

On project view, you can create package and classes by right-clicking on a source folder. For classes, class template file will be automatically generated.

Image new class

Building and cleaning workspace

Building workspace supports full build and incremental build.

Image build and clean workspace

Maven integration

Project view detects Maven project automatically. You can quickly open pom.xml file by clicking the opening icon on your project node.

Image open POM

Run Maven commands by right clicking the project node.

Image run maven commands

Add dependency by clicking the adding icon on Maven Dependencies node.

Image add Maven dep

More improvements

Last but not least, improvements have been made on debugging support, for example, added run and debug buttons onto editor title bar for single file debugging and added new configurations for JDWP. For more details, please refer to Debugger for Java.

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.

5 comments

Leave a comment

  • Avatar
    Toby

    Great to see the continued work on Java in VSCode, especially on the perf! 🙌

    I have a few criticisms though.

    – resource filters: VSCode already has settings for ignoring files, why not use those instead of duplicating?

    – A button to view POM file: hiding the file in the explorer view and adding a non-intuitive icon in a nonstandard placement instead… Why?!? I can’t imagine this would pass accessibility concerns that VSCode apparently spent quite a bit of effort improving over the last year or so.
    Maybe I am missing some aspect, but I don’t see how such a button is any improvement over just showing the file in the file list.🤷‍♂️

    • Avatar
      Jinbo WangMicrosoft employee

      – resource filters: VSCode already has settings for ignoring files, why not use those instead of duplicating?

      @Toby, thanks, this is definitely a good concern. I assume you’re talking about reusing files.exclude setting. Yes, if VS Code doesn’t show the files in File Explorer, then the Java extension should ignore them. But there are cases that you may want Java extension to ignore them but keep VS Code showing them. For example, for a polyglot workspace with frontend (e.g. node_modules) and Java files, i don’t want the Java extension to scan node_modules folder, but still show them in VS Code. A new setting can cover this scenario better.