Zed
Zed adds languages and servers through extensions; there is no OxL extension in the Zed catalog, so it is installed as a "dev extension" from a directory. Structure:
oxl-zed/
extension.toml
Cargo.toml
src/lib.rs
languages/oxl/config.toml
languages/oxl/highlights.scm# extension.toml
id = "oxl"
name = "OxL"
version = "0.1.0"
schema_version = 1
authors = ["you"]
description = "OxL language support"
[grammars.oxl]
repository = "file:///opt/oxl-1.0.0-beta/share/oxl/tree-sitter-oxl"
rev = "HEAD"
[language_servers.oxl-lsp]
name = "OxL language server"
languages = ["OxL"]# languages/oxl/config.toml
name = "OxL"
grammar = "oxl"
path_suffixes = ["oxl"]
line_comments = ["// ", "/// "]
tab_size = 2
brackets = [
{ start = "{", end = "}", close = true, newline = true },
{ start = "(", end = ")", close = true, newline = false },
{ start = "[", end = "]", close = true, newline = false },
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] },
]# Cargo.toml
[package]
name = "oxl-zed"
version = "0.1.0"
edition = "2021"
[lib]
path = "src/lib.rs"
crate-type = ["cdylib"]
[dependencies]
zed_extension_api = "0.3"// src/lib.rs
use zed_extension_api as zed;
struct Oxl;
impl zed::Extension for Oxl {
fn new() -> Self { Oxl }
fn language_server_command(
&mut self,
_id: &zed::LanguageServerId,
worktree: &zed::Worktree,
) -> zed::Result<zed::Command> {
let path = worktree.which("oxl").ok_or_else(|| "`oxl` is not in PATH".to_string())?;
Ok(zed::Command { command: path, args: vec!["lsp".into()], env: Default::default() })
}
}
zed::register_extension!(Oxl);Install with zed: install dev extension (command palette) and choose the directory oxl-zed. Rust with the target
wasm32-wasip1 is needed. Format on save: in settings.json — "languages": { "OxL": { "format_on_save": "on", "inlay_hints": { "enabled": true } } }.
Server options: "lsp": { "oxl-lsp": { "initialization_options": { "debounceMs": 150 } } }.
The Zed debugger works over DAP; oxl dap is given as the adapter command in .zed/debug.json (the format depends on the Zed
version, see debugging).