A Language Server Protocol implementation for pure, modern CSS, written in Go. Designed as a lightweight, fast alternative to vscode-css-languageservice.
| Category | Capabilities |
|---|---|
| Diagnostics | Unknown properties, duplicates, unknown at-rules, experimental property warnings, deprecated property warnings, empty rulesets, !important hints, vendor prefix hints, zero-with-unit hints, parse errors |
| Hover | Property documentation with MDN references, experimental status indicators |
| Completion | Properties, values, at-rules, pseudo-classes, pseudo-elements, HTML elements, color functions; experimental features tagged |
| Colors | Color picker for hex, named colors, rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch(); convert between formats |
| Navigation | Go to definition, find references, document symbols, document highlights |
| Editing | Rename CSS custom properties, code actions (quick fixes), formatting (expanded/compact/preserve/detect modes), selection ranges |
| Structure | Folding ranges, document links (@import, url()) |
| Workspace | Cross-file CSS custom property indexing |
Used by the Gossamer Zed extension. Compatible with any editor that supports LSP.
Download a binary from Releases, or build from source:
go install github.com/toba/go-css-lsp/cmd/go-css-lsp@latestgo build ./cmd/go-css-lspgo test ./...The formatter supports four modes, configured via initializationOptions:
| Mode | Behavior |
|---|---|
| expanded (default) | One declaration per line |
| compact | Single-line rulesets when they fit within printWidth |
| preserve | Keeps original single/multi-line layout, normalizes whitespace |
| detect | Infers intent from source: if the first property is on the same line as { and the result fits printWidth, single-line; otherwise expanded |
Rulesets containing nested rules always use expanded format regardless of mode.
{
"initializationOptions": {
"formatMode": "compact",
"printWidth": 80,
"experimentalFeatures": "warning",
"deprecatedFeatures": "warning"
}
}| Setting | Type | Default | Description |
|---|---|---|---|
formatMode |
string | "expanded" |
"expanded", "compact", "preserve", or "detect" |
printWidth |
int | 80 |
Max line width for compact/detect modes |
experimentalFeatures |
string | "warning" |
How to handle experimental CSS features: "ignore", "warning", or "error" |
deprecatedFeatures |
string | "warning" |
How to handle deprecated (obsolete) CSS features: "ignore", "warning", or "error" |
Nonstandard CSS properties are filtered out entirely and produce "unknown property" warnings. Experimental properties (e.g. field-sizing) are recognized but flagged based on the experimentalFeatures setting:
| Value | Diagnostics | Completions |
|---|---|---|
"ignore" |
None | No tagging |
"warning" (default) |
Warning severity | Tagged (experimental) |
"error" |
Error severity | Tagged (experimental) |
Deprecated (obsolete) CSS properties (e.g. clip) are recognized and flagged based on the deprecatedFeatures setting:
| Value | Diagnostics | Completions |
|---|---|---|
"ignore" |
None | No tagging |
"warning" (default) |
Warning severity | Tagged (deprecated), strikethrough |
"error" |
Error severity | Tagged (deprecated), strikethrough |
This project was built using the following as references for feature design and architecture:
- microsoft/vscode-css-languageservice (MIT) — CSS language intelligence and LSP feature set. The primary reference for what capabilities a CSS language server should provide.
- lmn451/css-variables-zed (GPL-3.0) — workspace-wide CSS variable indexing approach.
MIT — see LICENSE for details.