January 6th, 2020

Java on Visual Studio Code Update – January 2020

Xiaokai He
Senior Program Manager

Happy New Year and welcome back to our first update of Java on Visual Studio Code in 2020.

In this update, we’re introducing the long-waited “Call Hierarchy” support along with some Visual Studio Code UI updates which will benefit Java developers a lot. At the same time, new features are also introduced to Debugger and Test Runner. We will also share some other improvements including performance in this post. On to the update.

Call Hierarchy

A call hierarchy view shows all calls from or to a function and allows you to drill into callers of callers and call of calls. Just right-click on the functions and click Peek -> Peek Call Hierarchy.

UI Improvements for Java

Compact folders in Explorer

In the File Explorer, we now render single child folders in a compact form. In such a form, single child folders will be compressed in a combined tree element. Useful for Java package structures, for example.

Setting explorer.compactFolders controls this behavior. By default, this setting is turned on.

Problems panel

More predefined filters were added to the Problems panel. In addition to filtering by regular expression, you can now filter problems by type (errors, warnings, and information) and also see problems scoped to the current active file.

In addition, you can also show current problem in status bar to see the summary of the selected problem in the active file without any additional keyboard or mouse gestures.

Debugger updates

Visual Studio Code Java now supports ‘Data Breakpoint’, so you can have the debugger break when a variable change its value. See the illustration below

We’ve also improved the run/debug experience. You can see the new Runand Debug buttons in the debug panel, and you can also easily press F5 to start a debugging session.

By default, the run configuration (aka. launch.json) won’t be persisted in your workspace. If you would like to save it, you can click the button “Create a launch.json file” in the Debug viewlet.

Test Runner

If you have installed our Java Test Runner extension, you may notice that the new Test Explorer now shows the test status/results directly so you will go to the report only when more detailed information is needed.

More transparent build status

As you code in Visual Studio Code, the language server is building your workspace to provide you the necessary language features. Now you can see the detailed build task status and understand what’s happening behind the scene by simply clicking the language server status icon.

Performance improvements

To make coding in Visual Studio Code more enjoyable, We’ve made 2 enhancements to reduce the latency between typing and completion suggestions

  1. Remove duplicate calls of time consuming APIs.
  2. Limit completion results via java.completion.maxResults preference. By default, it’s limited to 50 completion results. You can change it to 0 if you’d like to see the full results list which might negatively impact the performance. We’re also working on more updates to further improve the experience, such as keybinding to load the full list and context aware search scope.

Other enhancements

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

  1. Code actions
    1. Support jump to definition on break/continue
    2. Sort code action suggestions by relevance.
    3. quickfix to correct access to static elements.
  2. Maven
    1. Support to “Collapse All” in Maven explorer.
    2. Support to specify the project for command “Maven: Add a dependency”.
  3.  Configurations
    1. New java.maven.updateSnapshots preference to update snapshots/releases for maven projects.
    2. New java.project.referencedLibraries preference to add jars to classpath. Other extensions can also use this API to update classpath.

We’d also like to thank Ondrej Musil to contribute to extension API. In order for Visual Studio Code Java to support more features, it’s important for us to make sure the core language server is extensible.

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.