Friends of OpenJDK Today

Two Million Java Developers on Visual Studio Code! November 2022 Update

December 19, 2022

Author(s)

  • Avatar photo
    Nick Zhu

    Senior Program Manager at Developer Division in Microsoft. Our team is currently based in Shanghai, China. I have worked on various product areas at Microsoft, such as Bing Ads, Azure ... Learn more

Hi everyone, we are excited to share that now there are over two million Java developers on Visual Studio Code, which wouldn't be possible without all the support from the community and our users, so thank you!

For the November update, we are bringing you new code editing features, such as postfix completion and optimized organize imports. In addition, the debugger gets a nice update, as we support a new feature called "Step Into Target". Lastly, we've made some visual enhancements to the Spring components.

So, let's get into it...

Postfix Completion

Postfix completion lets you add code snippets around an expression you've just typed and boosts your productivity.

It's a popular feature in JetBrain products and the community have requested this feature for our extensions as well. Through some investigation and changes to the upstream, postfix completion is now available in our latest release.

The postfix shortcuts we currently support are the following:

shortcut key template content description
cast ((SomeType) expr) Casts the expression to a new type
else if (!expr) Creates a negated if statement
for for (T item : expr) Creates a for statement
fori for (int i = 0; i = 0; i--) Creates a for statement which iterates over an array in reverse order
if if (expr) Creates a if statement
nnull if (expr != null) Creates an if statement and checks if the expression does not resolve to null
null if (expr == null) Creates an if statement which checks if expression resolves to null
sysout System.out.println(expr) Sends the affected string to a System.out.println(..) call
throw throw expr Throws the given Exception
var T name = expr Creates a new variable
while while (expr) {} Creates a while loop

Here's a demo for this feature:

Postfix Completion

We plan to continue adding more postfix shortcuts so stay tuned.

Optimized Organize Import

Organize import is one of the most common actions for Java developers during code editing. We have made several optimizations regarding this scenario.

  • Remove all unused imports from QuickFix

We have added this option to the QuickFix (the lightbulb icon) so you can remove all the unused imports all at the same time.

  • Add all missing imports from QuickFix

If there is an unresolved class, you can also use QuickFix to add all missing imports and pick the classes from the dropdown

  • Add all missing imports from source action menu

Another way to add all missing imports to right click to pull out the context menu, then select "Source Action", you will see "Add all missing imports" there as well.

Here's a demo for all features mentioned above

Organize import

We are continuing to add more improvements around "organize import" scenarios and you can find all our future plans in this GitHub issue. Feel free to leave your feedback or comments there.

Debugging - Step Into Target

Debugging into a statement with many nested function calls can be painful because you might have to step through functions you are not really interested into.

To improve this scenario, the Debug Adapter Protocol has supported the "Step Into Target" feature that displays UI for directly stepping into the function you are interested in.

In our latest Extension Pack for Java, we have started to support this feature.

When debugging has stopped on a statement, you can select "Step Into Target" from the context menu, which allows you to directly step into the function or target you are interested in. Here's a demo for this feature:

Step into target

Gutter Icons for Spring Components

Spring has always been our focus throughout the year. This time, we have added some visual enhancements to the editing areas so developer can better identify the Spring component and interact with Spring Boot dashboard.

With the latest release of Spring Boot Extension Pack, you will find gutter icons right next to Spring beans and endpoint mappings in the editor area.

This gives you visual clues that this is a Spring entity. When hovering on these components, a tooltip will pop up and you will see details about this component as well as a link to open it in Spring Boot dashboard. Here is a quick demo for this feature.

Spring gutter icon

Install Extension Pack for Java

To use all features mentioned above, please download and install Extension Pack for Java on Visual Studio Code.

Extension pack for Java

If you are a Spring developer working on a Spring Boot application, you can also download the Spring Boot Extension Pack for specialized Spring experience.

Spring boot extension pack

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:

Resources

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

Related Articles

View All

Author(s)

  • Avatar photo
    Nick Zhu

    Senior Program Manager at Developer Division in Microsoft. Our team is currently based in Shanghai, China. I have worked on various product areas at Microsoft, such as Bing Ads, Azure ... Learn more

Comments (0)

Your email address will not be published. Required fields are marked *

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

Save my name, email, and website in this browser for the next time I comment.

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard