Hi everyone, and welcome to the Visual Studio Code Java update. In this article, we will share our latest Gradle plugin, more convenient code operations (Getter/Setter, etc.), and the recent 1.0 Language Server release. In addition, according to statistics, we are very happy to see that VS Code has more than 1 million users using Java!
Language Server for Java™ 1.0 officially released
Recently, the 1.0 version of Language Server for Java™ was officially released on Visual Studio Code! This is an important milestone for Java support on Visual Studio Code and the result of many years of cooperation between Microsoft and Red Hat. Please visit this blog topic see release highlights and future plans.
Gradle for Java plugin released
Better Gradle support has always been one of the hottest topics in the community. In order to better meet the needs of developers for Gradle, we are happy to announce that we have released the latest " Gradle for Java " plug-in (previously called "Gradle Tasks" plug-in). This plugin was originally started by @badsyntax and is now maintained by Microsoft. Please note that this plug-in is currently not part of the Java plug-in package , you may need to download it separately.
Let's take a look at the specific highlights of this plugin:
Local Gradle installation support
In the previous version, the Gradle Wrapper in the project folder is a requirement of the plug-in. Users have mentioned the requirement ( Issue #1004 ) to support Gradle projects without Gradle Wrapper. This feature has been added to the latest version middle. Developers can now use the following settings to control the activation behavior.
- java.import.gradle.wrapper.enabled
- java.import.gradle.version
- java.import.gradle.home
For more details about these settings, you can visit
https://github.com/microsoft/vscode-gradle#vs-code-settings-1
Dependency management and project view
Another exciting new feature is the project dependency view. Developers can now easily view the dependencies in the project from the plugin.
To view the dependencies of the project, just click on the "Dependencies" item, you can expand to view all the dependencies in the project. These dependencies are grouped by Gradle configuration, and you can expand each configuration to view specific dependencies in detail. For omitted dependencies (marked with (*)), you can click the Inline button on the right to display the previously listed dependencies.
Gradle writing experience (Groovy)
The Groovy-based file writing experience in Gradle has also been greatly improved! Here are some new features:
Auto-completion:
The Gradle language server supports automatic completion of Gradle files. When you try to type Gradle properties or Closure in a Gradle script, the plugin will automatically suggest available Gradle statements for you.
When you enter dependencies in "Dependencies", the plugin will automatically search for dependencies in Maven Central Repo and suggest results for you.
Syntax highlighting:
When you open a Groovy Gradle file, the Gradle language server will start and provide you with syntax highlighting. We will provide you with Groovy syntax highlighting in the default style of Visual Studio Code. After the language server is started, it will analyze the opened Gradle file and provide semantic and other information to provide more accurate highlighting results.
file overview:
The Gradle language server will provide an overview view of the documentation for the current Gradle file. This type of view will help you easily navigate to any part of the Gradle file.
error message:
The Gradle language server will use the Groovy compilation engine to analyze the Gradle build files and report syntax errors (if any). It will also get the script classpath from Gradle Build so that it can report compilation errors. We support Gradle imports default.
There are many new features in the plugins released this time. Please visit GitHub document to see the complete function introduction! You can click this link get this Gradle plug-in.
More convenient code operation
We often receive feedback from users, pointing out that our current code operations are sometimes difficult to find. For example, in the previous version, developers need to right-click and select "Source Action" before they can find all Java code operations in the menu.
Now, developers can simply use the light bulb icon (quick fix) prompt to easily generate common Java functions. This is the list of functions we support:
- Generate Getter and Setter
- Generate hashCode() and equals()
- Generate toString()
This is a quick demo:
Feedback and suggestions
Please actively use our products! Your feedback and suggestions are very important to us and will help us do better. There are several ways to leave us feedback
- Fill out the Chinese questionnaire
- Leave a comment under this article
- Issue on our GitHub repo
In addition, according to statistics, we are very happy to see that VS Code has more than 1 million users using Java!
- Learn more about Java on Visual StudioCode
- Explore step by step Java tutorials on Visual Studio Code
Here are more Microsoft official learning materials and technical documents, scan the code to get the free version!
The content will be updated from time to time!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。