Find it on the VSCode Marketplace
See ./extension/vsix/README.md
for more details.
For development builds
bazel build //extension/vsix:java_bazel_language_support --stamp
For release
- Increment version in
extension/vsix/package.json
bazel build //extension/vsix:java_bazel_language_support
The Java language server uses the Java compiler API to implement language features like linting, autocomplete, and smart navigation, and the language server protocol to communicate with text editors like VSCode.
The Java compiler API provides incremental compilation at the level of files: you can create a long-lived instance of the Java compiler, and as the user edits, you only need to recompile files that have changed. The Java language server optimizes this further by focusing compilation on the region of interest by erasing irrelevant code. For example, suppose we want to provide autocomplete after print
in the below code:
class Printer {
void printFoo() {
System.out.println("foo");
}
void printBar() {
System.out.println("bar");
}
void main() {
print // Autocomplete here
}
}
None of the code inside printFoo()
and printBar()
is relevant to autocompleting print
. Before servicing the autocomplete request, the Java language server erases the contents of these methods:
class Printer {
void printFoo() {
}
void printBar() {
}
void main() {
print // Autocomplete here
}
}
For most requests, the vast majority of code can be erased, dramatically speeding up compilation.
The java service process will output a log file to stderr, which is visible in VSCode using View / Output, under "Java".
To build locally you will need;
- Bazelisk
- JDK v21 (limitation of
@rules_jvm_external//:extensions.bzl#maven.install
) - pnpm v9
There requirements are all met by the included devcontainer.