What CSL covers well
CSL combines “what shape is this config?” with “what rules must it follow?” — in one schema your tools can understand.
🔒 Type safety
Primitives, tables, arrays, and unions like "dev" | "prod".
🔍 Inline validation
Annotations such as @min(1), @regex("..."), @format(email).
⚖️ Constraints
Describe relationships with conflicts, requires, and validate ….
🧩 Flexible areas
Use wildcard keys *: and opaque types any{}/any[] to “leave room” safely.
🧠 Tooling‑ready
The language server powers completion, hover, diagnostics, rename, and navigation.
🌍 Multiple runtimes
Native CLI for speed, or Node + WASM for portability and integration.
Quick taste
A small schema showing types, annotations, defaults, and constraints.
config AppConfig {
app_name: string;
version: string @regex("^\\d+\\.\\d+(\\.\\d+)?$");
environment: "dev" | "prod" = "dev";
database: {
host: string @format(url);
port: number @range(1024, 65535);
ssl?: boolean;
};
insecure_mode?: boolean;
constraints {
conflicts database.ssl with insecure_mode;
requires database.ssl => environment == "prod";
};
}
Tooling built on LSP
CSL’s core implementation includes parsing + validation, a language server, and a docs generator—wired into editor extensions.
🧱 Native core (C++20)
Fast CLI for parsing/validation plus an LSP server that can run over stdio, sockets, or named pipes.
🧩 Node + WASM wrapper
Portable CLI/LSP entrypoint for environments where shipping a native binary is hard.
🧠 VS Code extension
Semantic highlighting, completion, hover docs, formatting, rename, and navigation.
🧠 IntelliJ plugin
LSP-powered editing plus a built‑in “Generate CSL HTML Docs” action.
📚 Documentation
Keep a schema and human-readable docs in sync—great for teams and reviewers.
🧪 Regression tests
Run the bundled suite to validate changes and ensure consistent behavior across platforms.
Get started
Pick your path: native, Node/WASM, or an editor integration. All of them ultimately talk to the same language server.
git clone https://github.com/nullptr-0/csl.git
cd csl
cmake -B build -S impl/core -DCMAKE_BUILD_TYPE=Release
cmake --build build
Test a schema
path/to/csl --test path/to/schema.csl
Run the language server
path/to/csl --langsvr --stdio (or --socket/--pipe)
# Build the WASM module
impl/core/BuildWasm Release
# Then compile the Node wrapper
cd impl/node
npm install
npm run compile
node ./out/csl.js --test path/to/schema.csl
node ./out/csl.js --langsvr --stdio
# 1) Build the native core (Native core tab)
# 2) Copy the resulting csl binary into:
# impl/extension/VSCode/core/
cd impl/extension/VSCode
npm install
vsce package
code --install-extension csl-0.0.1.vsix
Generate HTML docs
Right‑click a .csl file → Generate CSL HTML Docs to export a browsable site (including index.html).
Tip: If LSP features don’t start, double-check that the csl binary exists under impl/extension/VSCode/core/.
# 1) Build native csl (Native core tab)
# 2) Copy the resulting binary into resources:
# impl/extension/IntelliJ/src/main/resources/bin/<os>/csl(.exe)
cd impl/extension/IntelliJ
./gradlew build
./gradlew runIde
Generate HTML docs
Right‑click a .csl file → Generate CSL HTML Docs to export a browsable site (including index.html).
Tip: If LSP features don’t start, double-check that the csl binary exists under impl/extension/IntelliJ/src/main/resources/bin/<os>/.
Read the full spec
Everything from lexing rules to advanced constraint semantics lives in the docs page.
Learn by example
See how wildcard keys, unions, and constraints map to real-world formats.