Skip to main content

Language Server

The Mux compiler includes a Language Server Protocol (LSP) server. It runs over stdio and starts with:

mux lsp

Install a compiler release that includes the language server and make sure mux is available in the editor's environment. The editor still needs Mux syntax grammar support for highlighting; the grammar and language server are separate tools.

Compiler v0.13.0 introduced diagnostics, formatting, safe compiler fixes, document symbols, go to definition, hover, completion, and signature help. Compiler v0.14.0 adds workspace references and rename for resolved identifiers and user-defined members, semantic tokens, inferred local type hints, and folding ranges for declarations and control-flow blocks. References scan workspace files when requested. Editor clients may expose different subsets.

VS Code​

The maintained mux-lang.language-mux extension starts mux lsp automatically. Its v0.13.0 registry release is still pending; until then, use the source installation steps. If the compiler is not on PATH, set mux.serverPath to the full path of the mux executable in your editor settings.

Neovim​

For Neovim 0.11 or later, add a filetype and server configuration:

vim.filetype.add({ extension = { mux = "mux" } })

vim.lsp.config("mux", {
  cmd = { "mux", "lsp" },
  filetypes = { "mux" },
  root_markers = { "mux-project.json", ".git" },
})

vim.lsp.enable("mux")

Install a Mux syntax plugin separately if you want grammar-based highlighting.

Helix​

Add a server and language entry to languages.toml. Merge the [[language]] settings into an existing Mux language entry if your syntax plugin already defines one.

[language-server.mux-lsp]
command = "mux"
args = ["lsp"]

[[language]]
name = "mux"
scope = "source.mux"
file-types = ["mux"]
language-servers = ["mux-lsp"]
roots = ["mux-project.json", ".git"]

Other editors​

Configure the editor's LSP client to run mux lsp over stdio for .mux files. Set the workspace root to the project directory so the server can resolve imports and workspace references. Consult the editor's LSP setup docs for its client-specific configuration format.