@codemirror/lang-css
CSS language support for the CodeMirror 6 code editor, with highlighting, indentation, and autocompletion
Repository Health
Technical Analysis
@codemirror/lang-css implements CSS language support for the CodeMirror code editor. It is built on the Lezer CSS parser and extends it with syntax highlighting, indentation rules, and a completion source for CSS properties, variables, and value keywords.
Beyond plain CSS, the package exposes defineCSSCompletionSource, letting related CodeMirror language modes (such as Sass and Less) reuse its completion logic by supplying their own predicate for what counts as a completable variable in their dialect.
What You Get
- A
css()extension that adds full CSSLanguageSupportto a CodeMirror editor instance - A
cssLanguageprovider built on the Lezer CSS parser with highlighting and indentation baked in - A
cssCompletionSourcefor autocompleting CSS properties, variables, and value keywords - A reusable
defineCSSCompletionSourcefactory that CSS-dialect packages (Sass, Less) build their own completion sources on top of
Common Use Cases
- Adding CSS syntax highlighting and autocomplete to an in-browser code editor built on CodeMirror 6
- Building a live CSS playground or style editor with real-time property/value suggestions
- Powering CSS-in-JS or theme editors that need a lightweight, embeddable CSS editing surface
- Serving as the base completion logic for other CodeMirror CSS-dialect language packages (Sass, Less)
Under The Hood
Architecture - The package is intentionally small: src/css.ts (31 lines) wires the Lezer CSS parser into a CodeMirror LRLanguage and exposes the css() LanguageSupport extension, while src/complete.ts (229 lines) implements the completion logic, including the generic defineCSSCompletionSource factory that parameterizes what counts as a completable variable so other CSS-dialect packages can reuse it. Tech Stack - TypeScript, built against @codemirror/language, @codemirror/autocomplete, @codemirror/state, and @lezer/css/@lezer/common as peer building blocks, compiled via the shared @codemirror/buildhelper tooling used across the CodeMirror 6 package family. Code Quality - tests run through the shared cm-runtests CodeMirror test runner rather than an in-repo test suite; the code is compact and narrowly scoped, which limits surface area for bugs, but the low development_activity and maintenance_consistency health signals reflect that active development has moved to the project’s own Forgejo instance rather than GitHub. API Design - the public surface is minimal and composable: a single css() call for editor consumers, plus cssLanguage and cssCompletionSource as named exports for anyone customizing behavior, following the same small-surface convention as the rest of the @codemirror/lang-* package family.
Used by 21 apps in this directory
Sourcebot
AI Code Assistants · Developer Tools · Search
A self-hosted, AI-powered code search engine that indexes every repo across GitHub, GitLab, Bitbucket, Gitea, Gerrit, and Azure DevOps, so both engineers and coding agents can search, browse, and ask questions about your codebase from one place.
superset
AI Code Assistants · AI Development
Orchestrate an army of AI coding agents—Claude Code, Codex, Gemini CLI, and more—running simultaneously in isolated git worktrees from a single Electron desktop app.
Webstudio
Design Tools · No Code Platforms
Open source visual development platform with complete CSS control, headless CMS integration, and full infrastructure ownership