Java on Visual Studio Code Update – July 2022

Nick Zhu

Hi everyone, welcome to the July update of Visual Studio Code Java. We have brought exciting updates on Lombok support as well as a few other fundamental user experience improvements. Let’s get started!

Lombok Support

Lombok is a popular Java library that makes your coding life easier, and we have been consistently hearing from developers that our extensions don’t work well when they have Lombok dependency in their projects. Starting from a few months ago, we started investigating this and now we have fully enabled built-in support for Lombok within our extensions. You shouldn’t experience any weird issues with Lombok anymore.

We are also aware of the fact that some developers already install the community-developed Lombok extension, the original author @GabrielBB is moving on from the project, so Microsoft will maintain the extension from now on. We want to thank @GabrielBB who started it all and provided the original support for Lombok. We will add new features into this extension if necessary.

Let’s talk about the built-in support we have added for Lombok.

Enable Lombok support and user notification

When a project is opened for the first time, and if our extension detects that there is a Lombok dependency. We will send a notification to remind the developer if Lombok support needs to be enabled. After reloading Visual Studio Code, Lombok support becomes available. Here is a short demo.

Enable Lombok Support

Manage Lombok Version in the Language Status Bar

After enabling the Lombok support, the developer can see the current Lombok version and status in the language status bar. If the developer click on the item, it will take the developer to where the Lombok version is configured, this will easily allow the developer the change Lombok version.

After changing the Lombok version, there will be another notification require the developer to reload Visual Studio Code again. Here’s another demo to show this feature.

Change Lombok Version

Lombok Support Setting

If the developer does not want the built-in Lombok support, we have added a setting where it can be toggled on/off. Simply go to the settings and search for “lombok”. Here is a screeshot.

Lombok setting screenshot

User Experience Improvements

Apart from Lombok, there are several user experience improvements that will make your coding life easier.

Drag and Drop Support

We have now enabled “Drag and Drop” in our Java Project Explorer view, so you can use it in your convenience. Here’s a couple scenarios of how you can use it:

  • Move a class – Drag a class from one package to another package
  • Move a package – Drag a package into another package
  • Add a dependency – Drag a JAR file from operating system directly into a Java project that does not use build tools into “Referenced Libraries”

Let ‘s see a quick demo of the first scenario

Drag and drop

Inlay Hints Exclusion List

In April’s Blog, we first introduced our Inlay Hints for parameter names. We heard from developers that they liked the feature overall but in some cases, they might not want this feature to appear. Therefore, we have added a setting so that you can disable inlay hints under some circumstances. You can find this setting by typing “inlay exclusion” and clicking it under Java. Here is a screenshot.

Inlay exclusion

Debugging – Support function breakpoint

This feature request was originally raised in the community and addressed in the last release! Starting from version 0.24 of Extension Pack for Java. You can set a function breakpoint in Visual Studio Code by clicking the “+” button in the Breakpoints view and entering a fully qualified method name from a Java class. When in debugging mode, execution is paused at your specified function name and the debugger displays information about the execution context. This even works when functions have the same name (overloaded functions). Here is a quick demo.

Function breakpoint

More Code Actions

Last but not least, we have been adding more code actions to the Quick Fix prompt in the past few months and trying to make it smarter based on your code, so please give them a try.

Code Actions

Continued Spring Improvements – Bean Dependency View

In last month’s blog, we unveiled our brand new Spring Boot dashboard, but we are not done with our Spring improvements. We are adding new features each month. This time we are bringing you the bean dependency view. As a Spring developer, bean dependency is something that we deal with very often and sometimes we might want to visualize that. We added this feature to Spring Boot dashboard. It will become available when you launch the application from the Spring Boot dashboard, and click the inline button on the right. From there, you can go two directions. You can either see what this bean is injected into, or see what this bean is depending on. Let’s see a quick demo.

Bean Dependency

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: vscjfeedback@microsoft.com

Resources

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

5 comments

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

  • elat llat 4

    Nice!

    I hope vscjava.vscode-java-pack gets “Stack Trace Console”, “Git History”, and “Change Method Signature” features someday soon.

  • Gaëtan Varlet 0

    Thanks, VS Code is getting better at coding in Java.
    I think that an axis of improvement could be to have more code refactoring proposals like in IntelliJ for exemple.

    • Nick ZhuMicrosoft employee 0

      Yep, we hear that code refactoring is one area we can definitely improve. If you have any detailed suggestions, please let us know

  • Raul Valdoleiros 0

    Hi,

    Congrats for the nice work.
    I saw the version 1.9.0 is already out there, keep the good work 🙂

    I have two points:
    – There is a way to execute call hierarchy in get generated by lombok? I was able to use find all references but it wasn’t what I was looking for.
    – When search classes by * will work? I created an issue https://github.com/redhat-developer/vscode-java/issues/2443 and saw that this depends from other project, but this feature is very important and it seems stucked =/

Feedback usabilla icon