@codemirror/legacy-modes
A collection of over 100 ported legacy stream-parser language modes for CodeMirror 6
Repository Health
Technical Analysis
@codemirror/legacy-modes packages up the older, stream-based language modes originally written for CodeMirror 5 so they can be used with CodeMirror 6’s newer, more structured language system. Each mode is shipped as its own file under mode/<name>.js and exports a StreamParser that plugs into @codemirror/language’s StreamLanguage.define(), giving CodeMirror 6 editors syntax highlighting for languages that don’t yet have a dedicated Lezer grammar.
Because CodeMirror 6’s core distribution only ships first-class Lezer-based grammars for a handful of mainstream languages, this package fills the long tail: everything from APL and COBOL to Lua, Toml, and dozens of other syntaxes are available as drop-in stream parsers with no separate installation beyond this one package.
What You Get
- Over 100 individual language mode files, each importable independently as
@codemirror/legacy-modes/mode/<name> - Each mode exported as a
StreamParsercompatible with@codemirror/language’sStreamLanguage.define() - Coverage of legacy and niche languages (APL, COBOL, ASN.1, Asterisk dialplan, and many more) with no dedicated Lezer grammar in CodeMirror 6 core
- Both ESM and CommonJS builds via dual
import/requireexport conditions - TypeScript type declarations (
.d.ts) shipped alongside every mode
Common Use Cases
- Adding syntax highlighting to a CodeMirror 6 editor for a language that only has a CodeMirror 5-era mode, not a modern Lezer grammar
- Building general-purpose code editors or admin tools that need broad, long-tail language coverage rather than a curated few languages
- Migrating a CodeMirror 5 integration to CodeMirror 6 while preserving highlighting for less common languages already relied upon
- Embedding config-file or infrastructure-as-code editors (e.g. for formats like TOML, Dockerfile, or Nginx config) where a Lezer grammar doesn’t yet exist
Under The Hood
Architecture: The package has no shared runtime logic of its own beyond a thin per-mode wrapper — each mode/<name>.js file defines a CodeMirror 5-style stream parser (a state machine with a token() function reading one token at a time from a StringStream) and exposes it as a StreamParser object matching the shape @codemirror/language’s StreamLanguage.define() expects. There’s deliberately no central registry or barrel export; consumers import exactly the modes they need (@codemirror/legacy-modes/mode/lua), keeping bundle size proportional to usage. Tech Stack: Plain JavaScript (ESM, type: module) built with Rollup into dual ESM/CJS outputs, TypeScript used only for authoring .d.ts declaration files, with @codemirror/language as the sole runtime dependency providing the StreamParser interface being implemented. Code Quality: Tests run through cm-runtests, a shared CodeMirror test runner rather than an in-repo suite, so correctness is validated against upstream CodeMirror project conventions; individual mode files vary in sophistication (some are compact regex-driven tokenizers, others like clike.js implement more elaborate configurable state machines shared across several C-family languages) but follow a consistent token-function convention throughout, a legacy of their shared CodeMirror 5 origin. API Design: The per-language, per-file export convention is the package’s defining ergonomic choice — there is exactly one way to consume any given mode (import {lua} from "@codemirror/legacy-modes/mode/lua" then StreamLanguage.define(lua)), which keeps the API surface predictable across all 100+ modes at the cost of needing to know the exact file/export name for each language in advance.
Used by 23 apps in this directory
Arize Phoenix
Analytics · Devops · Monitoring
Open-source AI observability platform for tracing, evaluating, and debugging LLM applications with built-in intelligence and MCP support.
Portainer
Devops
A lightweight, open-source web UI that puts Docker, Kubernetes, and Podman management within reach of any team—no CLI expertise required.
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.
TensorZero
Ab Testing Experimentation · AI Development · Monitoring
TensorZero unifies the LLM gateway, observability, evaluation, optimization, and experimentation stack behind a single OpenAI-compatible API, built in Rust for sub-millisecond p99 latency.