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.
32 lines
861 B
Rust
32 lines
861 B
Rust
use zed_extension_api::{self as zed, Command, LanguageServerId, Os, Result, Worktree, current_platform};
|
|
|
|
struct StreamdExtension;
|
|
|
|
impl zed::Extension for StreamdExtension {
|
|
fn new() -> Self {
|
|
StreamdExtension
|
|
}
|
|
|
|
fn language_server_command(
|
|
&mut self,
|
|
_language_server_id: &LanguageServerId,
|
|
_worktree: &Worktree,
|
|
) -> Result<Command> {
|
|
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![],
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
zed::register_extension!(StreamdExtension);
|