According to surveys, one out of four Java developers uses Visual Studio Code (VS Code), Microsoft’s free, cross-platform IDE that has recently become a more fully-fledged Java IDE. New welcome and configuration screens ease project set-up, new project and hierarchy views make code navigation easier, quality-of-life improvements save coding time, and the Spring Framework and Microsoft’s Azure cloud service are now better integrated.
VS Code is a member of Microsoft’s Visual Studio IDE family, together with Visual Studio for Windows and Visual Studio for Mac. Microsoft claimed 14 million users for VS Code last February, up from 9 million in 2020 and 2.6 million at the end of 2017. There are approximately 8 million Java developers.
Two prominent surveys report Java IDE market share. The JRebel 2021 Java Technology Report (876 responses in August - November 2020) gave VS Code a 27% market share, IntelliJ IDEA 65%, and Eclipse IDE 48%. The Snyk JVM Ecosystem Report 2021 (over 2,000 responses in February - March 2021) pegged VS Code’s market share at 23%, IntelliJ IDEA at 72%, and Eclipse at 25%. Both reports allowed for multiple answers to this question. Snyk also found that every second developer uses more than one IDE, and every fourth developer uses four or more IDEs.
The Java Extension Pack extension contains the core Java IDE functionality for VS Code. A recent video on the Microsoft Developer YouTube channel detailed updates related to that extension.
- The new Welcome screen for Java projects offers to create a new project, open an existing project, or take a quick tour of the Java tools. New projects may use Maven archetypes, Spring Boot, Quarkus, and MicroProfile, but may also forgo build tools altogether. Microsoft added this screen in the February update of VS code as an experimental feature.
- The new Configure Java Runtime screen allows for setting the project JDK. It also displays all installed JDKs and offers to download JDKs from various OpenJDK distributions.
- The new Java Project view is modeled after the Project Explorer view of the Eclipse IDE.
- The type hierarchy view displays base classes and derived ones as a tree structure. This view is similar to the corresponding views in the Eclipse IDE and IntelliJ IDEA. Red Hat contributed this functionality.
- Moving a class to a new package with drag and drop now triggers a proper refactoring that updates all references to the class that was moved. Red Hat also built this functionality.
- The Maven view now displays all runnable goals in the "Lifecycle" section. Each plugin, however, still lists its goals separately.
- The Spring Boot Dashboard displays the main class of a Spring Boot project. This requires the extension of the same name and is part of the Spring Boot Extension Pack.
- Spring projects now display values of variables, fields, and parameters inside the source code during debugging. This requires the Spring Boot Tools extension, which is also contained in the Spring Boot Extension Pack. It relies on the inline value display for Java that Microsoft added in April.
- All JUnit test methods (such as
@BeforeEach
or@AfterAll
) may now be easily generated in a class through a context menu. Microsoft also added this in April. - Java projects that produce a JAR file may deploy to Microsoft Azure with a single click. This requires the Azure Tools extension.
- A new view for Spring Cloud projects on Microsoft Azure provides common operations, such as start, stop, or scale, directly in VS Code. This also requires the Azure Tools extension.
Microsoft also demonstrated two general Azure features with Java examples: Application Insights and DevOps Starter. Application Insights deliver application metrics similar to offerings from New Relic. These metrics are either collected by agents outside of deployed applications or by the applications themselves through an Azure SDK.
DevOps Starter creates an application complete with a GitHub repository, GitHub Actions for Continuous Integration, deployment to Azure, and tests. DevOps Starter Java projects may now use Gradle, which cuts down the build time from multiple minutes with Maven to 33 seconds as demonstrated in the example.
Oracle recently announced a VS Code extension for its Project Helidon microservices framework. This extension contains a project generation wizard and may also continuously compile and restart an application using the Helidon CLI that Oracle added in Helidon 2.0.
Microsoft supported Java 16 in VS Code in April 2021, a month after its release.