News

VS Code Gets Java Code Navigation Update, New Code Actions, More

The monthly update to Java on Visual Studio Code sees updated code navigation, new code actions, Java 13 support and more.

The Java functionality in the VS code editor comes from extensions in the tool's marketplace that provide code completion, refactoring, linting, formatting, code snippets, debugging and unit test support, and integrations with tools and frameworks including Maven, Tomcat, Jetty, and Spring Boot.

Here's a look at what's new in the October update, as detailed in an Oct. 18 blog post:

  • Code Navigation -- Go to super implementation -- "You can now keep track of class implementations and overriding methods by clicking the Go to Super Implementation link when hover."
  • Code Actions:
    • -- Create non existing package -- "Now when your package name doesn't match the folder name, you have the options to either change the package name in your code, or move the folder in file system (even when the destination folder doesn't exist yet)."
    • -- Add quick fix for non accessible references -- "This quick fix helps you resolve non accessible reference."
    • -- Automatically trigger auto-import on paste -- "If you paste blocks of code that contain references to classes or static methods and fields that are not yet imported, VS Code now can automatically add missing imports."
  • Refactoring:
    • -- Inline refactoring -- "The Inline refactoring lets you reverse the refactoring for a local variable, method, and constant."
    • -- Convert for-loop to for-each loop -- "The enhanced for-loop is a popular feature. Its simple structure allows you to simplify code by presenting for-loops that visit each element of an array/collection without explicitly expressing how one goes from element to element."
    • -- Convert anonymous class to nested class -- "This refactoring allows you to convert an anonymous class into a named inner class."
    • -- Deprecation tags for symbols and completions -- "Java extension now shows source code that references deprecated types or members with a strike-through line."
  • Code Snippets: "Now VS Code Java supports server side code snippets, which means it will provide more code snippets options in a context aware way."
  • Java 13 support: "Java 13 is out and VS Code is ready for it. It supports Java 13 through latest Java Extension. For developers use Java 12 with preview features, you will need to upgrade to JDK 13 to keep working with them."
  • Debugger: -- Show Run/Debug when hover -- "In case you don't like the Run/Debug button on the Code Lens of your main method, but still want easy access to the functionality, you can now configure to disable the Code Lens but still accessible by hover."
  • Maven Support: -- Resolve unknown type -- "Maven extension now supports searching Maven Central to resolve unknown type in your code. You can achieve this easily by clicking the link in hover."
  • Checkstyle:
    • -- Enhanced setting configuration command -- "Checkstyle: Set the Checkstyle Configuration command will now detect potential Checkstyle configuration files and list them. You can also provide a configuration file by directly writing a URL in the input box now."
    • -- Setting checkstyle version support -- "A new command Checkstyle: Set the Checkstyle Version is added to the extension."

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

Subscribe on YouTube