Hi everyone, and welcome to the March Update for Visual Studio Code Java. This time we'll bring you some of the latest updates on our code completion optimizations, Maven improvements, and our latest Java plugin preview release. let's start!
More shortcuts for generating code snippets
Since our language support for Java is provided through the Eclipse ™ JDT Language Server , the shortcuts for generating certain code snippets (eg System.out.println() ) are mostly Eclipse-style. For example, the shortcut for System.out.println() is sysout. However, we've heard from many users that they are used to shortcuts from other IDEs (such as IntelliJ IDEA) and would like to see VS Code support shortcuts for those IDEs as well. Therefore, we also added shortcuts to these commonly used code snippets in the plugin. Below is a list of our supported shortcuts.
Here is a demo showing these new shortcuts
Code completion optimization for constructors
Regarding code completion, one of the most frequently reported problems by users is that when writing constructors in VS Code, users generally hope that the completion prompts can be directly related to the defined types (for example, List<String> list = ..., prompts" ..." section should suggest list types such as ArrayList), however, this is usually not the case in current plugins.
Over the past few iterations, we've investigated this issue and made changes to improve this experience. With these new improvements, code completion will become more aware of the types users are creating and suggest the most relevant types for constructors. For example, defining List<String> will result in a suggestion for completion of new ArrayList<String>. Similarly, a String[] will result in an array type suggestion to complete the constructor. Here is a demo of this optimization:
We are still working on some tweaks to the above features and will release them in the next few releases.
Earlier this year, we released our 2022 roadmap , and a better code completion experience is one of our priorities. We want to continue improving this area, so if you'd like to see any other feedback on the quality and performance of code completion, please let us know (feedback channels are at the bottom).
Maven improvements
In addition to the new features for code completion, we've also made some improvements to the Maven plugin.
Show Maven POM file path
In previous plugins, when users opened multiple projects with the same name, it was difficult to distinguish which POM file the project belonged to. Also, showing the exact path to the POM file helps provide more information to the user. Therefore, we've added a small improvement: when the user hovers over the master node in the Maven plugin view, a prompt is displayed to show the full path to the Maven POM file. Here is a screenshot of this improvement:
Code completion in POM versions now correctly replaces versions
When autocompleting a version of a Maven dependency, previously our plugin would add the result to the existing text instead of replacing it, causing problems with our user experience. We fixed this in a recent release, autocompletion will now correctly replace versions, and similar improvements apply to artifactId and groupId. Here is a demo:
New Java plugin preview version mechanism
Since version 1.63 , Visual Studio Code has supported the preview version mechanism of plugins, so users can choose to install "Pre-Release Version" or "Release Version" for a plugin. Currently, we have enabled the pre-release channel for the Gradle for Java and Maven for Java plugins, and will enable the preview mechanism for other plugins in the Java plugin package at the end of this month. For users who always like to get the latest features, there is an option to install the preview version and give us first-hand feedback. For stable users, you can continue to use the "Release version" as before (default)
You can easily switch between the Preview Version (Pre-Release Version) and the Release Version (Release Version) using the additional button next to the "Install" button in Visual Studio Code (pictured below)
feedback and suggestions
There will be many exciting updates to Java on Visual Studio Code in 2022, and as always, your feedback and suggestions are very important to us and will help shape our future products. There are several ways to leave us feedback
- Click to fill in the Chinese questionnaire
- Leave a message under this article
- Create an Issue on our GitHub repo
resource
The following resources can help you better understand Java on Visual Studio Code
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。