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 at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube