r/ZedEditor • • 4h ago

rs-gopls: A fast, low-memory Go language server in Rust (works as a drop-in gopls replacement in Zed)

5 Upvotes

Hi r/zededitor,

I built rs-gopls, an open-source Go language server written in Rust (using Tree-sitter + incremental declaration indexes, with the Go toolchain for package graphs), and I use it directly in Zed as a drop-in gopls replacement.

Why it fits Zed well:

- Fast navigation & completion: In synthetic benchmarks (Windows x64, P50 / P95): completion 1.29 / 4.66 ms (first) and 0.54 / 2.63 ms (repeat); workspace symbols 0.09 / 0.14 ms; repeat Go to Implementation 0.21 / 0.32 ms.

- Low memory: 449 ms cold startup and 46.5 MiB peak working set on a 120-package test workspace (plus an opt-in RS_GOPLS_LARGE_FILE_MEMORY_OPT=1 mode for huge generated Go files).

- Works across everyday Go workflows: Go to definition / type definition, find references, bidirectional Go to Implementation (interface ↔ concrete type/method), completion & auto-import, hover, signature help, diagnostics, formatting, safe rename, inlay hints, and call/type hierarchy across go.mod, go.work, and GOPATH.

Install:

go install github.com/o0olele/rs-gopls/cmd/rs-gopls@latest

(Installs a tiny zero-dependency Go launcher that downloads, SHA256-verifies, and caches the matching prebuilt Rust binary from GitHub Releases for Linux, macOS Apple Silicon, and Windows. Prebuilt archives and Cargo builds are also available.)

Zed setup (.zed/settings.json or global settings.json):

{
  "languages": { "Go": { "language_servers": ["gopls"] } },
  "lsp": {
    "gopls": {
      "binary": {
        "path": "rs-gopls"
      }
    }
  }
}

(If your Go bin directory isn't on Zed's PATH*, replace* "rs-gopls" with the full path to the binary.)