From 82adb655f157438243d59e8ee201d7daed949daf Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Sun, 19 Apr 2026 21:16:04 +0200 Subject: [PATCH] feat: add Zed extension release artifact with WSL2 support The Zed extension now detects Windows via current_platform() and automatically uses `wsl streamd lsp` instead of `streamd lsp`, enabling seamless LSP support when Zed runs on Windows with streamd installed in WSL2. A pre-built zip (extension.toml + extension.wasm) is now built as `zed-extension-zip` and published to every release. The README gains a step-by-step WSL2 installation guide. --- .forgejo/workflows/release.yml | 5 +++++ README.md | 35 ++++++++++++++++++++++++++++++++++ zed-extension/src/lib.rs | 21 ++++++++++++++------ 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 4272d04..fce32e9 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -53,6 +53,10 @@ jobs: if: steps.version.outputs.SKIP != 'true' run: nix build .#streamd-windows -o result-windows + - name: Build Zed extension + if: steps.version.outputs.SKIP != 'true' + run: nix build .#zed-extension-zip -o result-zed-extension-zip + - name: Prepare release artifacts if: steps.version.outputs.SKIP != 'true' run: | @@ -60,6 +64,7 @@ jobs: cp result-deb release/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb cp result-musl/bin/streamd release/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64 cp result-windows/bin/streamd.exe release/streamd-${{ steps.version.outputs.VERSION }}-windows-x86_64.exe + cp result-zed-extension-zip release/streamd-zed-extension-${{ steps.version.outputs.VERSION }}.zip - name: Create release if: steps.version.outputs.SKIP != 'true' diff --git a/README.md b/README.md index ccc00c5..52b17e6 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,41 @@ Add to `~/.config/zed/settings.json`: The `"..."` keeps Zed's default Markdown servers (e.g. `marksman`) active alongside streamd. +#### Zed Extension (WSL2) + +If you run Zed on Windows with streamd installed inside WSL2, use the pre-built Zed extension instead of the manual config above. The extension auto-detects Windows and routes LSP communication through WSL2. + +**1. Install streamd in WSL2** (e.g. via the `.deb` package): + +```bash +wget https://git.konstantinfickel.de/kfickel/streamd/releases/download/vX.Y.Z/streamd_X.Y.Z_amd64.deb +sudo dpkg -i streamd_X.Y.Z_amd64.deb +``` + +**2. Download the extension** from the same release page: + +``` +streamd-zed-extension-X.Y.Z.zip +``` + +**3. Extract the zip** to a permanent folder on your Windows machine, e.g.: + +``` +C:\Users\\zed-extensions\streamd-zed-extension\ +``` + +The folder must contain `extension.toml` and `extension.wasm`. + +**4. Install the extension in Zed** via the command palette (`Ctrl+Shift+P`): + +``` +zed: install dev extension +``` + +Point Zed to the extracted folder. + +**5. Verify** by opening a Markdown file inside a directory that contains `.streamd.toml` — `@` completions and diagnostics should become active. + ### Neovim (nvim-lspconfig) **1. Register the server** — add to your Neovim config (e.g. `~/.config/nvim/init.lua` or a plugin file): diff --git a/zed-extension/src/lib.rs b/zed-extension/src/lib.rs index 04f1600..155d838 100644 --- a/zed-extension/src/lib.rs +++ b/zed-extension/src/lib.rs @@ -1,4 +1,4 @@ -use zed_extension_api::{self as zed, Command, LanguageServerId, Result, Worktree}; +use zed_extension_api::{self as zed, Command, LanguageServerId, Os, Result, Worktree, current_platform}; struct StreamdExtension; @@ -12,11 +12,20 @@ impl zed::Extension for StreamdExtension { _language_server_id: &LanguageServerId, _worktree: &Worktree, ) -> Result { - Ok(Command { - command: "streamd".into(), - args: vec!["lsp".into()], - env: vec![], - }) + let (os, _) = current_platform(); + if os == Os::Windows { + Ok(Command { + command: "wsl".into(), + args: vec!["streamd".into(), "lsp".into()], + env: vec![], + }) + } else { + Ok(Command { + command: "streamd".into(), + args: vec!["lsp".into()], + env: vec![], + }) + } } }