More Code Snippet Shortcuts, Optimized Code Completion — Visual Studio Magazine
Java on VS Code: more code snippet shortcuts, optimized code completion
The regular monthly Java update to Visual Studio Code sees the addition of shortcut snippets to align with other editors, optimized code completion, improvements to the Maven build automation tool, and more pre-release versions of extensions.
The Java development team on Microsoft’s Visual Studio Code manages extensions, including the Extension Pack for Java (12 million installs), which is a collection of six individual extensions that deliver the VS Code Java experience.
During this cycle, the team added more code completion shortcuts to generate code snippets, which were based on the Eclipse convention, because Java-specific functionality comes from the Eclipse JDT language server.
Developer feedback indicated that developers would like to have hotkey schemes from other IDEs available as well, as they are familiar. Microsoft has therefore added shortcuts for the popular IntelliJ IDEA offering. This means Eclipse style shortcuts like
sysout (for System.out.println()) and
syserr (for System.err.println()) correspond to IDEA style shortcuts
See the new feature at work in this animated graphic:
Following the code completion theme, the team has also optimized this feature when used with the
new keyword to create constructors in another reaction to developer comments, this time asking for a bit more awareness about the type being defined. “For example, a
List will result in a new suggestion
ArrayList. Likewise, a
String will result in a suggestion of an array type to complete the constructor,” Nick Zhu, senior program manager, said in a March 21 blog post.
Code completion is once again part of another improvement, that of the Maven build automation tool, which has received some tweaks. One presents a full path to the Maven POM file in a tooltip when a coder hovers over the main node in the Maven extension view. Another is a fix such that auto-completion of a Maven dependency build will replace the existing text instead of appending the new text to it.
Finally, the team continued to allow more expansions to be available in preview builds so developers could put things to the test early. Gradle Extensions for Java and Maven Extensions for Java are now enabled, with the remaining extensions expected to be available in preview builds by the end of this month.
David Ramel is an editor and writer for Converge360.