Microsoft continues its bid to win over Java developers by adding new features to its Visual Studio Code editor.
While VS Code is already hugely popular among developers in general, there are a variety of long-established IDEs (Integrated Development Environments) aimed at Java developers.
Nevertheless, Microsoft remains focused on tuning VS Code for use with Java, last month making it easier to get started using VS Code with Java and this month by making another round of improvements.
First up is streamlining of code refactoring via a refinement of the extract to variable/constant/method context menu command.
For example, selecting a chunk of code and then clicking the extract to method command would previously require developers to separately rename that newly created method encapsulating that extracted code. Now developers are given the option of renaming the method containing the extracted code when that method is created, cutting out that additional step.
The extract to field option can also now be used when selecting an expression or variable declaration.
Selecting Java code in VS Code is easier than ever, with the addition of support for Smart Selection for Java Code.
Smart Selection allows the developers to quickly select code using keyboard shortcuts to rapidly switch between selecting a single argument, whole lines, methods, classes, right up to every line of code in the file.
- To expand the current selection, use Shift + Alt + → on Windows, and Ctrl + Shift + Command + → on Mac
- To shrink the current selection, use Shift + Alt + ← on Windows and Ctrl + Shift + Command + ← on Mac
Finally, when used with VS Code, the Maven build automation tool now has improved support for Java Execution Environments, the build automation tool Gradle can be used with additional preferences, and the CheckStyle static analysis software can load in configuration files via HTTP URLs.
To find out more about Visual Studio Code’s bigger brother, Visual Studio 2019, check out our recent guide. If you’re interested in learning more about Java or in honing your skills, check out this round-up of the highest-rated guides and code examples on GitHub.