Molten

Editor tooling: VS Code

Molten ships a language server, cast-lsp, and a thin VS Code extension that starts it. The server uses the same checker as castc check, so the errors you see while typing are exactly the ones the build would report.

What you get

  • Errors as you type in .cast, .object, .level, .chunk, .screen, .ui and .style files, including unsaved changes in other open files.
  • Hover with types and doc comments.
  • Go to definition, rename, document and workspace symbols.
  • Completion, including component fields and the "molten" API.
  • Syntax highlighting (TextMate grammar).

Install

You need Node and npm to build the extension (VS Code itself supplies the runtime it runs on).

  1. Build the language server:

    cmake --preset debug
    cmake --build --preset debug --target cast-lsp
    
  2. Build the extension package:

    cd editors/vscode
    npm ci
    npm run package
    

    This writes build/cast-language.vsix.

  3. In VS Code, open the Extensions view, choose ... > Install from VSIX... and pick build/cast-language.vsix.

  4. Open a folder that contains a game.toml (the extension activates on it).

Finding the server

The extension looks for cast-lsp:

  1. at the path in the cast.serverPath setting, if set;
  2. in the standard Debug and Release build folders in or above the workspace (so a sample opened from a Molten checkout just works);
  3. on PATH.

After changing cast.serverPath, reload the VS Code window.

How it checks

The server rechecks the nearest game root (the folder with game.toml) whenever a file changes, using your unsaved buffers in place of the files on disk. Positions are reported in UTF-16, as VS Code expects.

The checker reports unknown fields, invalid values and @range warnings for Cast and built-in components, along with missing assets. Native component schemas become available when the game runs.

Other editors

cast-lsp speaks the Language Server Protocol over stdio, so any LSP client can launch it. Associate the file extensions above with it.

View this page's source on GitHub