LSP Configuration
This commit is contained in:
parent
4cb1328ad6
commit
3cd15d53a2
3 changed files with 219 additions and 10 deletions
17
README.md
17
README.md
|
|
@ -5,7 +5,8 @@ A rootless Podman container for running [OpenCode](https://github.com/anomalyco/
|
|||
## What this gives you
|
||||
|
||||
- A hash-pinned, integrity-verified build of OpenCode (not "latest" — an exact version, checked against a SHA256 captured at build time).
|
||||
- JDK 25 (LTS), Node 24 (LTS), pnpm, git, curl, openssh-client.
|
||||
- JDK 25 (LTS), Node 24 (LTS), Go, Rust, pnpm, git, curl, openssh-client.
|
||||
- Language servers for Go, Rust, TypeScript/JavaScript, Java, and Kotlin, ready for OpenCode's built-in LSP client (see [LSP support](#lsp-support) below).
|
||||
- The current directory mounted read-write as `/workspace`.
|
||||
- OpenCode's config, data, and session state shared across every workdir/container, so logging in once carries over everywhere.
|
||||
- Every container joined to a shared Podman network so it can reach other dev containers by name.
|
||||
|
|
@ -50,6 +51,20 @@ The edit is wrapped in `# >>> opencode-sandbox >>>` markers so re-running
|
|||
`make install` never duplicates it, and is skipped entirely if
|
||||
`~/.local/bin` is already on `PATH`.
|
||||
|
||||
## LSP support
|
||||
|
||||
OpenCode's built-in LSP client is off by default — turn it on per-project with `"lsp": true` in that project's `opencode.json` (or configure individual servers there; see OpenCode's own docs for the object form). Once enabled, this image is ready for it:
|
||||
|
||||
| Language | Server | How it gets there |
|
||||
|---|---|---|
|
||||
| Go | `gopls` | Built from source at image-build time (`go install`), pinned via `GOPLS_VERSION` in the Containerfile. |
|
||||
| Rust | `rust-analyzer` | Installed as a `rustup` component at image-build time — OpenCode has no auto-download fallback for this one, so it has to already be on `PATH`. |
|
||||
| TypeScript / JavaScript | `typescript` + `typescript-language-server` | Installed as global npm packages, pinned via `TYPESCRIPT_VERSION`/`TS_LS_VERSION`. Pinned to TypeScript's last JavaScript-based release (6.0.x) — TypeScript 7 is a native Go rewrite that dropped `tsserver.js`, which `typescript-language-server` needs to attach to. `NODE_PATH` is set so the global `typescript` package resolves even from a project with no local `node_modules`. |
|
||||
| Java | `jdtls` | Pre-baked — OpenCode has no auto-download fallback for Java at all, so this has to be on `PATH`. Fetched straight from Eclipse's own download server (not GitHub Releases; architecture-independent, pure JVM). No `bin/jdtls` ships upstream, so `scripts/jdtls` is a hand-written launcher wrapper — the same convention every other jdtls consumer (nvim-jdtls, mason.nvim, coc-java) uses — which also manages a persistent, per-project `-data` workspace dir under OpenCode's host-persisted data dir. |
|
||||
| Kotlin | `kotlin-lsp` | Pre-baked — JetBrains' official server (`github.com/Kotlin/kotlin-lsp`), fetched per-arch and hash-verified by hand (JetBrains publishes no checksum). Ships its own bundled JetBrains Runtime, so it needs none of this image's JDK. Symlinked as both `kotlin-lsp` and `kotlin-language-server`, since it's unconfirmed which name OpenCode's Kotlin integration expects. |
|
||||
|
||||
Bumping a pinned LSP version means editing the corresponding `ARG`/`FROM` tag in the Containerfile and rebuilding (`make build`).
|
||||
|
||||
## How it's put together
|
||||
|
||||
**Containerfile** — multi-stage build on `debian:trixie-slim`:
|
||||
|
|
|
|||
Reference in a new issue