Skip to content
ashxudevPublic

About

Cerebras Software Language syntax highlighting for Zed

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

CSL for Zed

Zed syntax highlighting for Cerebras Software Language (CSL).

This extension is intentionally scoped to match the bundled Cerebras VS Code highlighter. It is not a complete CSL parser or language server.

Provides

  • .csl file recognition as CSL.
  • // line comments.
  • CSL keywords such as const, var, fn, layout, task, if, else, for, while, return, struct, and comptime.
  • CSL @identifier builtins such as @import_module, @set_tile_code, and @range.
  • Primitive and storage-like types such as i16, i32, u16, u32, f16, f32, bf16, cb16, bool, color, data_task_id, and control_task_id.
  • Constants such as true, false, EAST, WEST, NORTH, SOUTH, and RAMP.
  • Strings, character literals, escape sequences, numeric literals, operators, punctuation, bracket matching, and basic indentation.

Does Not Provide

  • A CSL language server.
  • Autocomplete, diagnostics, typechecking, go-to-definition, or semantic token support.
  • A complete CSL parser. The grammar is lexical and block-aware so it can support highlighting at roughly the same level as the VS Code TextMate grammar.

Reference Highlighter

The reference implementation is the Cerebras SDK VS Code highlighter:

csl.vscode/syntaxes/csl.tmLanguage.json

That file is a TextMate grammar. Zed does not consume TextMate grammars directly, so this extension translates the same token categories into a minimal Tree-sitter grammar plus Zed query files.

Install for Local Development

Clone the repo, then install it as a Zed development extension:

git clone https://github.com/ashxudev/zed-csl.git

In Zed:

  1. Open the command palette.
  2. Run zed: extensions.
  3. Choose Install Dev Extension.
  4. Select the cloned zed-csl folder.

Repository Layout

extension.toml
languages/csl/config.toml
languages/csl/highlights.scm
languages/csl/brackets.scm
languages/csl/indents.scm
tree-sitter-csl/

tree-sitter-csl/ is the bundled Tree-sitter grammar. extension.toml points Zed at this same GitHub repo and uses path = "tree-sitter-csl" to locate the grammar subfolder.

Development

The grammar source lives in:

tree-sitter-csl/grammar.js

If you change the grammar, regenerate parser files with:

cd tree-sitter-csl
pnpm install
pnpm run generate

Then commit the regenerated files and update the grammar rev in extension.toml to the commit SHA that should be used for the grammar.

About

Cerebras Software Language syntax highlighting for Zed

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages