VS Code Java September 2021 UpdateNovember 01, 2021
Hi everyone, welcome to the September edition of the Visual Studio Code Java update!
In this article, we are going cover the new release of Gradle extension, more convenient Code Actions and the recent 1.0 language server release.
Language Server for Java™ 1.0 Release
The 1.0 release of the Language Server for Java™ was officially released recently! We believe this is an important milestone and result of a multi-year collaboration between Microsoft and Red Hat. Please visit this special announcement here on Foojay to see the release highlights as well as future plans in detail.
Gradle for Java Extension Release
Better Gradle support has been one of the top asks in the community. To better address the Gradle needs for developers, we are excited to announce that we have now released the "Gradle for Java" extension (previously called "Gradle Tasks" extension). This extension was originally started by @badsyntax and is now maintained by Microsoft. Please note that this extension is not yet part of Extension Pack for Java and you may need to download it separately.
Let's take a look at some highlights of this new version:
Local Gradle installation support
In previous version, Gradle wrapper in the project folder is the requirement for the extension. There was a feature request (Issue #1004) to support Gradle projects without wrapper, this feature was added to the recent release. Developers can now use the following settings to control the activation behavior.
More details about these settings can be found at
Dependency Management and Project View
Another exciting new feature is the project dependency view. Developers can now easily view the dependencies in a project from the extension.
To view the dependencies of a project, simply click on the "Dependencies" item and all dependencies of a project is shown below. These dependencies are grouped by Gradle configurations and you can expand each configuration to see the dependencies in detail. For omitted dependency (marked with a (*)), you can click on the inline button on the right to reveal the previously listed dependency.
Gradle Authoring Experience (Groovy)
Gradle file authoring experience in Groovy is also greatly improved! There are a few new features we want to highlight:
The Gradle language server supports basic auto completions for a Gradle file, when you're trying to type a Gradle closures or properties in a Gradle script, the extension will automatically suggest available Gradle closures for you.
When you're typing a dependency in "dependencies" closure, the extension will automatically search in the Maven central and suggest result for you.
When opening a Groovy Gradle file, the Gradle language server will start and provide language features for you. Basically, we offer Groovy syntax highlighting (using VS Code default style) in Gradle files. After language server starts, it will analyze the opened Gradle file and provide semantic tokens information, providing more precise highlighting results.
The Gradle language server will provide the document outline for the current Gradle file. This type of view will help you to navigate to any part of the Gradle file easily
The Gradle language server will use Groovy compile engine to analyze the Gradle build file and report syntax errors if exist. It will also get script classpaths from Gradle Build so that it can report compilation errors. The Gradle default imports are supported.
More Convenient Code Actions
We have been constantly receiving feedback that the current code actions are sometimes hard to find. Previously, developer has to right click, select "Source Action" and then find all the Java code actions in the menu.
Now, developers can simply use the lightbulb icon (Quick Fix) to generate common Java functions. Here is a list of scenarios we support
- Generate Getters and Setters
- Generate hashCode() and equals()
- Generate toString()
Here is a quick demo:
Feedback and Suggestions
Please don't hesitate to try our product! Your feedback and suggestions are very important to us and will help shape our product in future. There are several ways to leave us feedback
- Leave your comment on this blog post
- Open an issue on our GitHub Issues page
Here is a list of links that are helpful to learn Java on Visual Studio Code.
- Learn more about Java on Visual Studio Code.