Java is one of the most important languages for Visual Studio Code. Microsoft has shown keen interest in the Java community. It attracts Java’s top developers by providing timely updates to its open-source Cross Platform Editor, VS Code.
The updates for Java on VS Code come in the form of several updated Java extensions. Microsoft combines and markets these as an Extension Pack for Java. The benefit? A package that supports Java developers who want to use VS Code.
The Java Extension Pack is available in the Editor’s Marketplace. The package consists of six different extensions, which include:
- Language Support for Java Extension by Red Hat
- A debugger for Java
- Java Test Runner
- Maven for Java
- Java Dependence View, and
- Microsoft’s in house auto-complete tool, Visual Studio IntelliCode powered by Artificial Intelligence.
As of June 2020, users had downloaded the extension pack more than 4.4 million times. This is an encouraging number for Microsoft. It proves that the giant’s time, resources and top developers are well-invested.
Frequent enhancements in VS Code extensions improve experience and productivity of Java coders. The enhancements also serve to keep Java Coders satisfied and to keep VS code in the spotlight.
In June 2020, elite software engineers introduced some noticeable enhancements. These were primarily in ‘Debugging’ and ‘Refactoring’. The display of the Java Language Level on the editor’s status bar was another change.
A new feature in the debugging extension allows developers to attach the debugger by process ID. It requires:
- Installation of the latest version of the debugger extension, (available in the Java Extension Pack)
- Some minor configuration settings to enable this new functionality.
Refactoring has also improved. Now, renaming a folder via the file explorer will kick off package refactoring by default.
The first time, users will see a prompt asking them to confirm whether they always want to:
- Automatically refactor packages or
- Preview changes before applying it off manually or
- Turn it off completely
The behavior is controlled by “java.refactor.renameFromFileExplorer” present in the preference setting. It provides the following options to the user:
- Never: Do not enable refactoring for rename operations on File Explorer.
- Auto Apply: Always automatically update the imports and package declarations.
- Preview: Always preview the changes before applying.
- Prompt: Ask user every time to confirm whether to bypass refactor preview or not.
Java Language Level
As Java evolves, Java Developers deal with different a Java Language Level in their work. Now, VS Code applies language level for your project based on project setting. In the latest enhancement, the status bar in VS Code displays the Java Language Level. This facilitates Java Developers by giving immediate visibility. It does not force them to open a project file to look for the Java Language Level whenever required.
The good news doesn’t end here. Users can configure their own JDK settings by clicking the Language Level on the status bar. It redirects them to ‘java.configuration.runtimes’ setting.
Users need to install the latest version of Language Support for Java Extension by Red Hat. Users must also set the active editor tab to a ‘.java’ file.”
See Also: Building Plugins And Extensions: Things All Java Developers Need To Know
Along with these three major upgrades, some minor enhancements were also introduced . Such changes are usually overlooked by mainstream media. But many Java coders recognize and appreciate them. Especially since elite software engineers conducted plenty of research to develop these features. They might seem trivial. But their impact on a Java Developer’s productivity and efficiency is noticeable.
Other minor features introduced earlier this year are:
- The “Create Java Project” command that now allows Java Coders to select creating a Java project with Maven support or a project without any build tools. It is worth remembering that a Java project with Maven support needs the Maven extension installed on your system.
- A new argument of “sourcePaths” is included. This supports specifying the source path as part of customer configuration for running tests. It can be found under “java.test.config” in the preference settings.
- A new command, “Import Java Projects In Workspace” allows Java developers to add a module into an open project. (Without restarting the window).
Microsoft rolls out new Java updates for VS code in 2 months or less. This benefits more than 4 million developers in the world who use Java for development. Any dominating programming language attracts other giants in the industry. In this case, the dominating language is Java, the fastest growing language in the world.
From the perspective of a Java developer, it is a win-win situation. VS code being an open-source code editor, does not need developers to pay anything. The new features and enhancements are an attractive bonus for top tech talent.