News

Oracle Offers Java Language Server Tool for VS Code

Oracle announced a language server tool for Java developers using Visual Studio Code to provide language-specific "smarts" in the super-popular, open source-based, cross-platform code editor.

The new offering isn't exactly filling a void, as Microsoft's Java Extension Pack for Java (22.5 million installs) in the VS Code Marketplace bundles the Language Support for Java(TM) by Red Hat tool (nearly 29 million installs).

The new Java Platform Support from Oracle, meanwhile, was just added to the marketplace two days ago, Oct. 18, and at the time of this writing has been installed 1,247 times, earning a perfect 5.0 rating from five developers who reviewed it.

[Click on image for larger view.] Java Platform Support from Oracle (source: Oracle).
[Click on image for larger view.] Language Support for Java(TM) by Red Hat (source: Oracle).

Oracle noted that there are good specialized IDEs for working with Java, but the huge popularity of VS Code (which acts like a full-fledged IDE with its many extensions) sees many more developers using it -- such as students -- and the company wants everyone to have a good experience in the IDE of their choice. A big difference between the Red Hat Java extension used by Microsoft and the Oracle tool is the language server they're based on.

Language servers, which follow the Language Server Protocol, are instrumental to coding with the VS Code extensions, as Microsoft's Language Server Extension Guide for VS Code says they typically provide functionality including:

  • Autocomplete: They offer suggestions for code completion as you type, making it faster and easier to write code.
  • Error-checking (Diagnostics): They highlight syntax errors, undefined variables, and other potential issues in your code.
  • Jump-to-definition: They allow you to quickly navigate to the definition of a variable, function, or class by clicking on its usage.
  • Go-to-reference: They enable you to find all references of a variable, function, or class in your code.
  • Hover Documentation: They provide documentation for variables, functions, and classes when you hover over them with your cursor.
  • Code Formatting: They automatically format your code according to a specified style guide.
  • Refactoring: They assist with renaming variables, extracting methods, and other code refactoring tasks.
  • Code Navigation: They help you navigate through your code with features like symbol search and file search.

"At the core of a VS Code extension supporting a programming language is a language server -- a backend that operates the language's tools and communicates with the IDE using the Language Server Protocol," explained Oracle in announcing the new VS Code tool on Oct. 18. "Our Java language server is a slimmed down version of the one we developed in the Apache Netbeans project, and it is based on the OpenJDK JDK's javac compiler for code editing and compilation and on OpenJDK's debugger interface for debugging. This allows us to offer VS Code IDE support for new JDK features as soon as they are introduced, even during Early Access of the JDK. To this effect, our VS Code Extension will support the current JDK releases as well as the next upcoming JDK version."

Oracle said the tool initially supports:

  • A project view
  • Auto-complete
  • Error highlighting
  • Jump to definition
  • Some forms of automated refactoring
  • JavaDoc-on-hover
  • Debugging support
  • Unit-testing support for JUnit
  • Support for Gradle and Maven projects

The Red Hat language server that's used in Microsoft's bundled Java extension pack, meanwhile, says it offers:

  • Supports code from Java 1.5 to Java 20
  • Maven pom.xml project support
  • Gradle project support (with experimental Android project import support)
  • Standalone Java files support
  • As-you-type reporting of parsing and compilation errors
  • Code completion
  • Code/Source actions / Refactoring
  • Javadoc hovers
  • Organize imports
    • triggered manually or on save
    • when pasting code into a java file with Ctrl+Shift+v (Cmd+Shift+v on Mac)
  • Type search
  • Code outline
  • Code folding
  • Code navigation
  • Code lens (references/implementations)
  • Highlights
  • Code formatting (on-type/selection/file)
  • Code snippets
  • Annotation processing support (automatic for Maven projects)
  • Semantic selection
  • Diagnostic tags
  • Call Hierarchy
  • Type Hierarchy

"The increasing popularity of Visual Studio Code as a universal IDE has changed the relationship between programming languages and their IDEs," Oracle said this week. "In the past, developers (at least those who weren't staunch vi or Emacs fans) first picked a language and then picked an IDE for that language. Today, many developers expect that language-agnostic IDEs like VS Code provide good support for every language they might work with. We're proud that Java has excellent specialized IDEs, which many large companies and dedicated Java professions rely on, but there's a large number of Java developers who use VS Code, especially among students learning Java and people who use other languages alongside Java. We want Java programmers to have a good experience in their preferred IDE."

There are other Java language servers available in the VS Code Marketplace, including one based on NetBeans -- just like Oracle's tool -- from the Apache Software Foundation (ASF). Described as a technology preview, the Language Server for Java by Apache NetBeans has been installed more than 126,000 times.

Oracle said its new language server will continue being developed as part of the Apache NetBeans project (Oracle contributed NetBeans to the ASF), and Oracle will continue contributing to that project, but the VS Code extension (the client side) will be developed in a separate open source project.

That open source project on GitHub is Oracle Java Platform Extension for Visual Studio Code.

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