Visual Studio Code now supports virtual threads

The recently released Java 19 comes with JEP 425 preview of Virtual Threads as part of the Loom project. VSCode was quick to adapt it.


Virtual threads are heralded as the big game-changer for Java – even as a replacement for reactive programming. You get all the goods but not the complexity, with few changes to the current API.

In the September VSCode release, initial support for virtual threads in the Java debugger has been enabled, while in the October release this support has been improved. Note that you will need to install JDK 19 to use this feature.

In addition to enabling virtual thread debugging support, VSCode’s general debugging capabilities have also been enhanced by adding visual indicators for inline breakpoints.

Consider a line like this:

Stream.of(“Frank”).map(name -> name.toUpperCase()).forEach((item -> System.out.println(item));

Now when you set a breakpoint on this line, Visual Studio Code automatically identifies the lambda expressions in this line and visualizes them with gray dots. If you want to set more inline breakpoints on these lambda expressions, you can click these gray dots directly, and the gray dots will turn into red dots like normal breakpoints, then the debugger will stop at these breakpoints during code execution.

This is another Java-integrated VSCode upgrade following its recently added Spring enhancements:

  • Spring bean properties when live process is connected
    The IDE helps to list all beans loaded when the Spring application itself is loaded. With this new addition, VScode goes one step further by also revealing bean property information, ie. e whether it’s singletons, prototypes, etc., while also marking your own beans with “defined” to keep things organized.
  • A better startup experience for projects initialized with Spring Initializr
  • Maven and Gradle improvements in Java Project Explorer

It is therefore not surprising that Microsoft is pushing its tools towards Java, since yes, Microsoft also likes Java!

More information

Visual Studio Java Code Update – October 2022

Related Articles

Microsoft goes all out for Java

Visual Studio Code adds command center and server

Visual Studio Code adds language detection

To be informed of new articles on I Programmer, subscribe to our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook Where LinkedIn.

Banner


pico book



comments

or send your comment to: [email protected]

Comments are closed.