Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>CruftNew to Visual Studio Code? Get it now.
Cruft

Cruft

Yakup Cemil K.

| (0) | Free
Language Server and VS Code extension for the Cruft programming language
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

lsp_cruft

Language server and VS Code extension for the Cruft language (.cruft).

Semantics follow cruftc in the sibling Cruft tree. The server lexes, parses, and type-checks open files, resolves import / use / export against std/ and library paths, and speaks LSP over stdio or VS Code IPC.

Features

  • Diagnostics — parse and type errors in the editor
  • Hover — types, signatures, and documentation
  • Go to definition — jump to declarations
  • Find references — usages across the workspace
  • Rename — symbol renaming with conflict checks
  • Completion — keywords, symbols, and snippets where supported
  • Signature help — call sites for functions and builtins
  • Semantic tokens — full and range highlighting from the type checker, including affine, borrowed, shared, arena, and erased HoTT names
  • Quick fixes — share a moved binding, add a missing import, or switch a static-only var to const
  • Folding — fold fn / if / while / match / type / scope arena … end regions
  • Document outline — symbols in the file explorer
  • Path inspection — hover and CodeLens show path endpoints, normalization steps, and transports. Erased HoTT and interval names are dimmed.
  • Arena profile — CodeLens on scope arena reports allocation count and a static size estimate. Empty arenas, nested arenas, and unread affine values are warnings.
  • Typed holes — ? completion can insert a typed literal, refl(...), transport(...), or a call whose parameters and return type match.
  • Constant evaluation — pure arithmetic, pure calls, and transports get a ▶ CodeLens. The result is also shown as ghost text. Click the lens for the reduction steps.
  • Architecture views — Command Palette: Cruft: Module Dependency Graph, Cruft: Ownership Flow, Cruft: Arena Topology, and Cruft: Search by Type ((i32, i32): i32 or : i32). Workspace symbol search accepts the same type queries.

Settings

Setting Description
cruft.stdPath Path to the Cruft standard library tree. Point this at the directory that contains the std package (for example the Cruft/std folder in a full Cruft checkout).
cruft.libPaths Extra library search paths (array of strings) for resolving import / use.
cruft.trace.server LSP trace: off, messages, or verbose.

Example (settings.json):

{
  "cruft.stdPath": "C:/path/to/Cruft/std",
  "cruft.libPaths": []
}

Install and run from source

  1. Dependencies

    cd lsp_cruft
    npm install
    
  2. Build

    npm run build
    

    This typechecks the project and bundles it into dist/:

    • extension.js — VS Code extension client
    • server.js — language server launched by the extension
    • cli.js — cruft-lsp command; starts server.js

    The language client and server dependencies are bundled, so an installed extension does not need this repository's node_modules.

  3. Package a VSIX

    npm run package
    

    That runs the production build, then vsce package, and writes lsp-cruft-0.1.0.vsix. npx vsce package does the same thing.

    Install the .vsix in VS Code, Cursor, VSCodium, or another compatible editor with Extensions: Install from VSIX…. Open a .cruft file to activate the language.

  4. Development host

    • Open the lsp_cruft folder in VS Code.
    • Run Launch Cruft Extension from the Run and Debug view (F5).
    • Open a .cruft file to activate the language.
  5. Other editors

    Editors that are not VS Code-compatible can launch the stdio server directly:

    node dist/cli.js
    

    Send the standard library through LSP initializationOptions when the editor does not support VS Code settings:

    { "cruft": { "stdPath": "C:/path/to/Cruft/std", "libPaths": [] } }
    

Scripts

Script Purpose
npm run build Typecheck and bundle into dist/
npm run watch Rebuild the bundles on change
npm run package Production bundle, then vsce package
npm test Compile and run the checker tests

Layout

  • src/diag.ts — diagnostic codes, related information, finalize/dedupe pipeline (aligned with cruftc message families)
  • src/sync.ts — versioned AST synchronization: incremental text edits, decl fingerprints, structural node ids
  • src/compiler.ts — optional bridge to sibling cruftc --check for authoritative diagnostics
  • src/lexer.ts, parser.ts, check.ts — Cruft frontend aligned with cruftc (ownership, arenas, cubical HoTT)
  • src/queries.ts, server.ts, cli.ts — LSP handlers and stdio entry (cruft-lsp)
  • src/extension.ts — VS Code client (IPC to the bundled dist/server.js)
  • esbuild.js — bundles the extension and language server for dist/ and the VSIX
  • syntaxes/cruft.tmLanguage.json — TextMate grammar
  • language-configuration.json — comments, brackets, indentation, folding

Point cruft.stdPath at Cruft/std (or a checkout that contains mem.cruft). Set cruft.useCompiler to merge diagnostics from a local cruftc build when available.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft