Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/elfrask/cls/llms.txt

Use this file to discover all available pages before exploring further.

The ccls-lang VS Code extension ships inside the repository at .vscode/extensions/ccls-lang/ and provides full language support for CLS source files (.clsx), type interface files (.clsi), and project manifests (cls.json). It activates automatically on any file associated with the clx language ID and covers syntax highlighting, string interpolation, CMX markup, bracket matching, code snippets for every language construct, JSON schema validation for cls.json, and an optional dark color theme with differentiated colors for types, classes, functions, and generics.

Installation

1

Copy the extension folder

Copy the ccls-lang directory into your VS Code extensions directory so it is permanently available:
cp -r .vscode/extensions/ccls-lang ~/.vscode/extensions/
2

Or use the workspace extension (no copy needed)

If you open the CLS repository directly in VS Code, the editor picks up .vscode/extensions/ccls-lang/ automatically — no manual copy required.
3

Reload VS Code

Press Ctrl+Shift+PDeveloper: Reload Window to activate the extension.
The extension is registered under publisher: frask, name: cls-lang, and targets VS Code ^1.80.0. It depends on vscode-languageclient ^10.1.0 for optional LSP integration.

Supported File Extensions

ExtensionLanguage IDDescription
.clsxclxCLS source files
.clsiclxType interface files
cls.jsonjsonProject manifest (schema validated)
All three extensions are associated with the clx language via .vscode/settings.json:
{
  "files.associations": {
    "*.clsx": "clx",
    "*.clx": "clx",
    "*.clsi": "clx"
  }
}

Features

Syntax Highlighting

The extension uses a TextMate grammar (syntaxes/clsx.tmLanguage.json) to highlight every token category in CLS source:
Token categoryExamples
Comments# this is a comment
Numbers42, 3.14
Strings"hello", 'world', `template`
String interpolation$name, ${expr}
Keywordsif, else, elif, while, for, function, var, const, return, is
TypesInt, String, Float, Bool, i32, str, Tuple, Record
Operators+, -, ==, !=, ->, ::, ++, |
CMX / JSX tags<Component attr={expr}>children</Component>
Constantstrue, false, null, unknown
Self referencesme, super

New Syntax Features (Highlighted)

The grammar also handles the full set of modern CLS type syntax:
SyntaxExample
Heterogeneous tuplesvar p: (Int, String) = (1, "x");
Union literalsalias Color = "red" | "green" | "blue";
Type aliasesalias Vec3 = (Int, Int, Int);
Generic interfacesinterface Hello<T=Int> { num: T }
Type extractionvar n: Hello["num"] = 1;
Genericsfunction id<T>(x: T) -> T / class Caja<T>
Phantom typesinterface M<T> { f: !T }
Inheritance with :class Dog: Animal
is / superd is Dog, super.speak()
Visibility modifiersprivate, protected, readonly, static

CMX Syntax Support

CMX is CLS’s native JSX-like markup syntax. The extension highlights both lowercase tags (which produce a CmxValue) and uppercase tags (which trigger a reference lookup), plus {expr} interpolation inside attributes and children.
var el = <button label="Click" onClick={handleClick} />;

var comp = (
    <Container>
        <Header />
        <Body>{ content }</Body>
    </Container>
);

Bracket Matching and Auto-closing

Language configuration (language-configuration.json) defines bracket pairs for matching and auto-closing:
OpenClose
()
[]
{}
""
''
``
Surrounding pairs use the same set, so selecting text and typing an open bracket wraps the selection.

Comment Toggling

The line comment character is #. Use Toggle Line Comment (Ctrl+/) to comment or uncomment selected lines.

Code Snippets

The extension registers two snippet files: clsx.json for .clsx / .clsi files, and cls.json.json for cls.json manifests.

CLS Source Snippets (clsx.json)

PrefixDescription
fnFunction with return type
fnvVoid function (no return)
fngGeneric function function id<T>(x: T) -> T
fnaAsync function with await
clsClass with constructor and method
clsgGeneric class class Caja<T>
clshInheritance with : and super
clsvClass with private/protected/public/readonly/static members
intfInterface with fields and method signatures
intfgGeneric interface with default type parameter
extType extraction var v: Interface["field"] = …
alitTuple type alias
aliuUnion literal alias
alifFunction type alias
alirRecord type alias
structStructure declaration
modModule with exported function
nsNamespace
impimport "module" as alias
impffrom "module" import symbol
ifIf / else block
whWhile loop
lpInfinite loop with break
forC-style for loop
feFor-each loop
feiFor-each with index
swSwitch with case and default
tryTry / catch block
tupTyped tuple variable
arrTyped array variable
recTyped record variable
constConstant with inferred literal type
arrowArrow function
cmxCMX element with children
enumEnum with variants
enumusEnum usage (access + comparison)
enumiIterate enum variants
tostr__toString magic method
isopis operator expression
supsuper.method() call
mainfunction main(args: String[]) -> int entry point

Manifest Snippets (cls.json)

PrefixDescription
clsmanifestFull cls.json with all compiler, interpreter, and sandbox options
clsminMinimal cls.json with name, version, and entry
clssandboxSandbox configuration block
clsdepsDependencies block
The cls.json file is also validated against the bundled JSON schema (snippets/cls.schema.json). VS Code will show inline validation errors for unknown keys or wrong value types.

Color Theme: CLS Tipos Diferenciados

The extension includes a dark theme called CLS Tipos Diferenciados that assigns distinct colors to CLS-specific token scopes. To activate: Press Ctrl+K Ctrl+T and select CLS Tipos Diferenciados from the picker.
Token scopeColorStyle
Primitive types (storage.type.*.ccls)Teal
Classes / interfaces / aliases (entity.name.type.ccls)GoldBold
Functions (entity.name.function.ccls)Soft yellow
Class methods (entity.name.function.method.ccls)Blue
Generics / type access / tuplesCyan
Phantom types !TPurpleBold
This theme is uiTheme: vs-dark and is designed to pair with any other dark base theme.

VS Code Settings

The workspace .vscode/settings.json controls both editor behavior and optional CLS extension features:
{
  "editor.indentSize": 2,
  "editor.semanticHighlighting.enabled": true,
  "files.associations": {
    "*.clsx": "clx",
    "*.clx": "clx",
    "*.clsi": "clx"
  },
  "cls.options.unnestableFeatures": {
    "lspServer": false,
    "useStaticTypes": true,
    "useMapClsi": true
  }
}
SettingDefaultDescription
cls.options.unnestableFeatures.lspServerfalseConnect to clx lsp for diagnostics and completions
cls.options.unnestableFeatures.useStaticTypestrueEnable static type checking in the LSP pipeline
cls.options.unnestableFeatures.useMapClsitrueLoad .type.json maps from .cls-types/ for autocomplete
The LSP server is disabled by default (lspServer: false). Set it to true and run clx lsp to enable real-time diagnostics, hover documentation, and go-to-definition. See the LSP Server page for details.

Build docs developers (and LLMs) love