Skip to content
NeikiDevPublic

About

Extension for Zed to support Java

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Java for Zed: JDTLS + IntelliJ

Java support for Zed with a choice of two language servers:

This is an unofficial fork of zed-extensions/java. Everything the official extension does still works.

Important

  • This project is not affiliated with JetBrains or Zed Industries.
  • The IntelliJ language server is proprietary JetBrains software. Using it needs an IntelliJ IDEA Ultimate subscription. A 30-day trial is available.
  • The extension downloads the server directly from JetBrains. This repository does not contain or redistribute it.
  • Zed is not an officially supported editor for the IntelliJ server.

What works with IntelliJ

Tested with Maven, Spring Boot 4.2 and JPA:

✅ Completion with auto import (List (java.util))
✅ Snippets: sout, fori, iter, psvm and more, and class, interface, record, enum in a new file
✅ Generate getters and setters, constructors (all fields, final fields, none), equals() and hashCode(), a builder, toString() from the code actions menu
✅ Javadoc: type /** above a method and get @param, @return and @throws
✅ IntelliJ inspections, quick fixes, rename, find references, formatting
✅ TODO, FIXME and XXX comments in the diagnostics panel, like with JDTLS
✅ Go to definition into the JDK and your dependencies (classes without sources open as a signature stub)
✅ Debugging main methods and single tests (also Spring Boot apps)
✅ Lombok: completion, diagnostics and navigation for generated members, without extra setup
✅ Spring: "Could not autowire" warnings, wrong Spring Data query methods
✅ JPQL completion inside @Query
✅ Spring Data method name completion (findByEmailAnd…)
✅ application.properties and application.yml: completion of Spring Boot keys, go to definition on a key (properties)
✅ Maven or Gradle import progress in the status bar
✅ pom.xml: completion of groupId, artifactId and version from your local Maven repository, and of ${...} properties

The full list and the reasons are in docs/intellij.md.

Setup

1. What you need

  • Zed 1.30 or newer (tested with 1.30.2)
  • Rust, installed with rustup. Zed uses it to build the extension.
  • Maven or Gradle for your projects. Check with mvn -v or gradle -v. The IntelliJ server does not bring its own Maven.
  • A JDK for your projects
  • About 3 GB of free disk space (server and indexes)
  • An IntelliJ IDEA Ultimate license or trial

2. Install the extension

git clone https://github.com/NeikiDev/java.git zed-java-intellij

In Zed, open the command palette (cmd-shift-p on macOS, ctrl-shift-p on Linux and Windows), run zed: install dev extension and select the zed-java-intellij folder. The first build takes a minute.

This extension has the same id as the official Java extension, so it replaces it while installed. To go back, uninstall it and install "Java" from the extension store again.

3. Read the JetBrains User Agreement

The server is covered by the JetBrains User Agreement. By setting accept_eula in the next step, you accept it.

4. Turn IntelliJ on

Open your Zed settings (zed: open settings) and add:

{
  "languages": {
    "Java": {
      "language_servers": ["intellij", "!jdtls", "..."],
      "debuggers": ["intellij_jvm"]
    },
    "Properties": {
      "language_servers": ["intellij", "..."]
    },
    "YAML": {
      "language_servers": ["intellij", "..."]
    },
    "XML": {
      "language_servers": ["intellij", "..."]
    }
  },
  "lsp": {
    "intellij": {
      "settings": {
        "accept_eula": true,
        "data_sharing": "none"
      }
    }
  }
}

The YAML part is for application.yml. The XML part is for pom.xml and needs Zed's XML extension, see Maven pom.xml files. Leave it out if you do not want it.

Want IntelliJ only in some projects? Put the languages part into .zed/settings.json of those projects instead.

5. Open a project

Open a Maven or Gradle project and a .java file. The first start downloads the server (about 390 MB) and indexes your project. You can watch the progress in the status bar.

6. Activate your license

After the download, open a terminal. First save the server path:

# macOS
IJ=$(echo ~/Library/Application\ Support/Zed/extensions/work/java/intellij/*/server/bin/intellij-server)

# Linux
IJ=$(echo ~/.local/share/zed/extensions/work/java/intellij/*/server/bin/intellij-server)

Then pick one:

"$IJ" license login    # sign in with your JetBrains account (if you have a subscription)
"$IJ" license trial    # or start a free trial

Check it worked with "$IJ" license status. Then run editor: restart language server in Zed. Done!

Other ways (license file, company license server, Windows) are described in docs/intellij.md.

Updating

The IntelliJ server updates itself (checked at most once a day). The extension does not, because it is installed as a dev extension. To update it:

cd zed-java-intellij
git pull

Then click Rebuild next to the extension in Zed's extensions panel (zed: extensions).

Settings

Everything goes under lsp.intellij.settings in your Zed settings. Only accept_eula is required. After changing a setting, run editor: restart language server.

General

Setting Example What it does
accept_eula true Accepts the JetBrains User Agreement shipped with the server, including versions installed by later updates. Without it the server does not start.
data_sharing "none" What the server sends to JetBrains: "none" (default), "anonymous", "test" or "full".
region "europe" Region for product terms and data processing: africa, americas, apac, china, europe, middle_east or oceania.
jvm_args ["-Xmx1g"] JVM options for the server, for example a lower or higher memory limit (default 2 GB).
check_updates "always" When to look for a new server version: "always" (default, at most once a day), "once" or "never".
system_path "/path/to/dir" Absolute path where the per-project server folders go. Default: your OS cache folder.
todo_tags ["TODO", "FIXME"] Comment tags shown as diagnostics (see TODO comments). Default: ["TODO", "FIXME", "XXX"]. [] turns them off.

License (details in docs/intellij.md)

Setting Example What it does
license_file "~/idea.key" Use a license key file. While it is set, the server uses only this file.
license_server "https://license.example" Company license server (floating licenses).
ca_certificates ["/path/ca.pem"] Extra CA certificates (PEM or DER), for a license server or TLS proxy with a private company CA.

Project and editor

These use the same keys as the JetBrains VS Code extension.

Setting Example What it does
intellij.buildTool "gradle" Which build tool to import with when a project has both Maven and Gradle files.
intellij.jdkForSymbolResolution "/path/to/jdk" The JDK the server resolves your code against, if it picks the wrong one.
intellij.projects [] Externally configured projects.
intellij.completion { "caseSensitivity": "firstLetter" } How strictly completion matches upper and lower case.
jetbrains.java.hints.types.local variable false Inlay hint for the type of var variables.
jetbrains.java.hints.types.call chain false Inlay hints for the types in a chain of method calls.
jetbrains.java.hints.settings.method parameter false Inlay hints for parameter names at call sites.
jetbrains.java.settings.types.lambda parameter false Inlay hints for the types of lambda parameters.
jetbrains.java.hints.collapse complex types false Shorten long generic types in inlay hints.

The inlay hint settings are on by default and are read live. The other settings in this group are applied when the server starts.

Development

Setting Example What it does
lsp_proxy_path "/path/to/java-lsp-proxy" Use a locally built java-lsp-proxy instead of the downloaded one.
intellij_server_path "/path/to/server-root" Use your own server installation instead of the managed download. Must be the folder that contains bin/intellij-server and EULA.txt.
eula_hash "0123456789abcdef" Only with intellij_server_path: the first 16 hex digits of the SHA-256 of its EULA.txt (shasum -a 256 EULA.txt | cut -c1-16).

All of them in one block:

"lsp": {
  "intellij": {
    "settings": {
      // Required. `true` accepts the JetBrains User Agreement shipped with
      // the server build in use, including builds installed by later updates.
      "accept_eula": true,

      // Privacy and region. Defaults: "none" and no region.
      "data_sharing": "none",       // "none" | "anonymous" | "test" | "full"
      "region": "europe",           // africa | americas | apac | china | europe | middle_east | oceania

      // License (see "License" below).
      "license_file": "/path/to/license.key",        // INTELLIJ_SERVER_LICENSE_FILE
      "license_server": "https://license.example",   // JETBRAINS_LICENSE_SERVER (floating licenses)
      // Extra CA certificates (PEM or DER) the server trusts, for example
      // the private CA of a company license server or TLS proxy.
      "ca_certificates": ["/path/to/company-ca.pem"],

      // JVM options for the server itself.
      "jvm_args": ["-Xmx4g"],

      // Where the per-project server folders go. Default: your OS cache folder.
      "system_path": "/path/to/intellij-system",

      // Update checks for the server download: "always" (default, at most
      // once a day) | "once" | "never".
      "check_updates": "always",

      // Comment tags shown as diagnostics. Default: ["TODO", "FIXME", "XXX"].
      // [] turns them off.
      "todo_tags": ["TODO", "FIXME", "XXX"],

      // Use a locally built java-lsp-proxy instead of the downloaded one.
      "lsp_proxy_path": "/path/to/java-lsp-proxy",

      // Use your own server installation instead of the managed download.
      // It must point at the folder that contains bin/intellij-server and EULA.txt.
      "intellij_server_path": "/path/to/intellij-server-root",
      // Only needed with intellij_server_path: the first 16 hex digits of
      // the SHA-256 of its EULA.txt (shasum -a 256 EULA.txt | cut -c1-16).
      "eula_hash": "…",

      // Server settings, using the same keys as the VS Code extension.
      // Applied when the server starts (restart it after changing them):
      "intellij.buildTool": "gradle",                 // when both Maven and Gradle files exist
      "intellij.jdkForSymbolResolution": "/path/to/jdk",
      "intellij.projects": [],                        // externally configured projects
      "intellij.completion": { "caseSensitivity": "firstLetter" },
      // Read live:
      "jetbrains.java.hints.types.local variable": false
    }
  }
}

The server itself is turned on per language, not here: see step 4 for Java, Spring Boot properties files for .properties files and Maven pom.xml files for pom.xml.

Try it

The examples/ folder has three small projects with a checklist each:

All of them already switch to IntelliJ in their .zed/settings.json. Open one in Zed and follow its TESTING.md.

Roadmap

Ideas for what could come next. None of this is built yet. "Seen" means the server announces the feature (a bundled plugin, a command or a capability) but it has not been tried from Zed; "tried" means the command was called and returned useful data.

Idea What the server offers Status
Values and hover in application.properties Type, default value and the values set in the project for each key (intellij.spring.boot.configValues) Tried: no list of allowed values, so only booleans and existing values could be offered
Kotlin files A Kotlin plugin and Kotlin debug support Seen. The extension only attaches the server to Java and Properties
More in pom.xml Nothing: the server answers every request in a pom.xml with an empty result Tried. Go to definition on a dependency and artifacts that are not in the local repository would have to be built in the proxy
Spring XML files An XML plugin Seen
Bazel projects A Bazel plugin; the intellij_bazel debug adapter is already wired up Seen, never tested with a Bazel project
Run tests without the debugger, with results Test discovery per file and module, used today only for the debug buttons Tried for discovery. Zed has no test results view for extensions
Spring beans and endpoints Lists of beans and HTTP endpoints with their locations (intellij.spring.beans, intellij.spring.endpoints) Tried. Needs a place in Zed to show them
Clickable stack traces Commands that resolve a stack trace line to a file and line Seen
IntelliJ tools for the AI agent 23 tools (run configurations and more) reachable through the server Tried: the list is returned. Would need a bridge to a Zed context server

Want one of these, or something else? Open an issue. Features the server itself lacks are better requested from JetBrains.

Something does not work?

Problem Fix
Cannot run program "mvn", dependencies unknown Install Maven, then quit Zed completely and open it again
Another language server already uses the instance directory Wait a few seconds, then editor: restart language server
Asks you to set accept_eula Do step 3 and 4
Starts, but nothing works Activate your license (step 6)
High CPU or memory use Normal for some minutes after opening a project (indexing). Set a memory limit with jvm_args, see Resource use

Logs: dev: open language server logs → intellij. More help in docs/intellij.md. If you are still stuck, open an issue.

Documentation

Building the proxy yourself

The extension downloads a small helper program, java-lsp-proxy, from this repository's releases. To build it yourself (you need Rust):

cargo build --release -p java-lsp-proxy

Then point the extension to it:

"lsp": { "intellij": { "settings": { "lsp_proxy_path": "/absolute/path/to/target/release/java-lsp-proxy" } } }

How downloads are checked

Download Check
java-lsp-proxy, gradle-lsp-bridge SHA-256 from release-checksums.json, recorded by the release workflow
IntelliJ server Newest version over HTTPS. The version name is checked before it is used in a path or URL.
JDTLS, Lombok, JDK, java-debug, Java Test Runner, Gradle Language Server Downloaded over HTTPS as in upstream, without a checksum

A download that does not match its checksum is deleted and not started. Restarting the language server downloads it again. A path you set yourself (lsp_proxy_path, intellij_server_path and others) is used as it is.

Changes compared to upstream

This fork is based on zed-extensions/java v6.8.31 and adds:

  • The opt-in intellij language server: download, license and privacy settings, configuration
  • IntelliJ debug adapters (intellij_jvm, intellij_gradle, intellij_bazel) and gutter debugging of mains and tests
  • Proxy support for IntelliJ: library sources from jar: links, stubs for classes without sources, hover links, a debug relay, key completion in application.properties, dependency completion in pom.xml, Spring Data method name completion, templates for new Java files, code actions that generate getters, setters, constructors, equals() and hashCode() (leaving out what Lombok writes), Javadoc completion after /**
  • Completion labels that show the package (List (java.util)), with rarely wanted types (java.awt, JDK internals) sorted last
  • Native binaries downloaded from this repository's releases and checked against SHA-256 checksums

Credits

  • This fork's IntelliJ support was written by NeikiDev together with Claude, Anthropic's AI model, which also reviewed and security-tested it
  • zed-extensions/java and all its contributors, for the extension this fork is based on
  • tartarughina, for the original IntelliJ integration this fork builds on
  • iainh/intellij-lsp, for showing how to run the server outside VS Code

License

The code in this repository is licensed under the Apache License 2.0.

The IntelliJ language server is not part of this repository. It is governed by the JetBrains User Agreement. IntelliJ and IntelliJ IDEA are trademarks of JetBrains s.r.o.

About

Extension for Zed to support Java

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages