Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Java+Bazel Language SupportNew to Visual Studio Code? Get it now.
Java+Bazel Language Support

Java+Bazel Language Support

Jordan Mele

|
1,210 installs
| (0) | Free
Fork of George Fraser's Java Langauge Server extension with updates and improved Bazel support.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Java+Bazel Language Support

This is a fork of George Fraser's Java Language Server VSCode extension.

A Java language server based on v3.0 of the protocol and implemented using the Java compiler API.

This extension is focused on supporting Java alongside Bazel. At present;

  • Gracefully handles Bazel analysis failures where possible.
  • Supports bzlmod, Bazel's new external dependency management system.

This has been tested against Java code in the Bazel repository, all imports correctly resolve.

Resolved Import Resolved Import

Unresolved Import Unresolved Import

Credit

  • George Fraser, whose extension this is a fork of.
    • Language Server
    • Debug Server
  • Red Hat, who maintain their own Java extension.
    • Syntax highlighting (textmate grammer)

Features

Javadoc

Javadoc

Signature help

Signature help

Autocomplete symbols (with auto-import)

Auto import 1

Auto import 2

Autocomplete members

Autocomplete members

Go-to-definition

Goto 1

Goto 2

Find symbols

Find workspace symbols

Find document symbols

Lint

Error highlight

Type information on hover

Type hover

Find references

Find references 1

Find references 2

Debug

Debug test

Settings

If the language server doesn't detect your external dependencies automatically, you can specify them using .vscode/settings.json

{
    "java.externalDependencies": [
        "junit:junit:jar:4.12:test", // Maven format
        "junit:junit:4.12" // Gradle-style format is also allowed
    ]
}

If all else fails, you can specify the Java class path and the locations of source jars manually:

{
    "java.classPath": [
        "lib/some-dependency.jar"
    ],
    "java.docPath": [
        "lib/some-dependency-sources.jar"
    ]
}

You can generate a list of external dependencies using your build tool:

  • Maven: mvn dependency:list
  • Gradle: gradle dependencies

The Java language server will look for the dependencies you specify in java.externalDependencies in your Maven and Gradle caches ~/.m2 and ~/.gradle. You should use your build tool to download the library and source jars of all your dependencies so that the Java language server can find them:

  • Maven
    • mvn dependency:resolve for compilation and autocomplete
    • mvn dependency:resolve -Dclassifier=sources for inline Javadoc help
  • Gradle
    • gradle dependencies for compilation and autocomplete
    • Include classifier: sources in your build.gradle for inline Javadoc help, for example:
      dependencies {
          testCompile group: 'junit', name: 'junit', version: '4.+'
          testCompile group: 'junit', name: 'junit', version: '4.+', classifier: 'sources'
      }
      
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft