News

Java on VS Code: More Snippet Shortcuts, Optimized Code Completion

The regular monthly update to Java on Visual Studio Code sees added shortcut snippets aligning with other editors, optimized code completion, improvements to the Maven build automation tool and more pre-release version of extensions.

Microsoft's Java on Visual Studio Code dev team maintains extensions, including the Extension Pack for Java (12 million installs), which bundles six individual extensions that provide the VS Code Java experience.

In 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 developers would like to see shortcut schemes from other IDEs be available too, since they are familiar. So Microsoft added shortcuts for the popular IntelliJ IDEA offering. That means Eclipse-style shortcuts like sysout (for System.out.println()) and syserr (for System.err.println()) are matched with IDEA-style shortcuts sout and serr.

See the new functionality at work in this animated graphic:

Snippet Shortcut Demo
[Click on image for larger, animated GIF view.] Snippet Shortcut Demo (source: Microsoft).

Following the code-completion theme, the team also optimized that functionality when used with the new keyword to create constructors in another reaction to developer feedback, this time requesting a little more awareness about the type being defined. "For example, a List<String> will result in a suggestion for new ArrayList<String>. Similarly, a String[] will result in a suggestion of an array type to complete the constructor," said Nick Zhu, senior program manager, in a March 21 blog post.

Code completion is yet again part of another improvement, this one to the Maven build automation tool, which received a couple tweaks. One presents a full Maven POM file path in a tooltip when a coder hovers over the main node in the Maven extension view. Another is a fix such that auto completing a Maven dependency version will replace the existing text instead of adding the new text onto it.

Finally, the team has continued to enable more extensions to be available in pre-release versions so developers can put the bits through their paces early. Now enabled are Gradle for Java and Maven for Java extensions, with the remaining extensions planned to be available in pre-release versions by the end of this month.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

Subscribe on YouTube