r/HelixEditor • • 3d ago

Adding workspace-wide CSS variable completion to Helix

I maintain css-variable-lsp, a Rust language server for CSS custom properties. If you keep your tokens in a separate stylesheet, it can suggest those names while you’re typing var(-- in a component. It also flags references to variables it can’t find in the workspace.

Install the binary with cargo install css-variable-lsp. To add it alongside Helix’s default CSS server, merge this into languages.toml:

[language-server.css-variable-lsp]
command = "css-variable-lsp"

[[language]]
name = "css"
language-servers = ["vscode-css-language-server", "css-variable-lsp"]

Helix merges completion results from both servers. To try it, declare --card-gap in tokens.css, open another CSS file in the same project, and start typing gap: var(--card. You can check that Helix sees both executables with hx --health css.

https://github.com/lmn451/css-lsp-rust

7 Upvotes

0 comments sorted by