/vscode-wgsl

Rich language support for WebGPU Shading Language

Primary LanguageRustApache License 2.0Apache-2.0

WGSL Language Server and VS Code Extension

This project aims to provide rich editor support for WebGPU shading language via a standalone language server (implementing the language server protocol), and a VS Code client extension that interfaces with it.

Architecture

This workspace is a monorepo. Specific documentation for the individual packages contained in this repo can be found under their respective project directories (under packages).

User-facing documentation for the VS Code extension can be found under packages/client/README.md.

Workspace Overview

  • packages/client — The VS Code extension / LSP client implementation
  • packages/grammar — The TextMate grammar, providing fast first-pass syntax highlighting for VS Code
  • packages/parser — A fast, standalone, hand-written recursive descent parser for WGSL
  • packages/server — The LSP server implementation

Quick Start

  • Install Node.js LTS ≥ v20.12.2
  • Install Rust Stable and Nightly channels
  • Install JavaScript dependencies
    npm ci
  • Build and install the extension locally
    npx nx build client --package --install

Note

Nightly Rust is needed only for the server's build command, because it uses the unstable --out-dir argument to place the compiled executable in the correct location for local development.

Build System Overview

The repo is managed by Nx, a flexible, polyglot monorepo manager and build-system framework written in TypeScript. Workspace configuration is defined in nx.json at the root of the repository, while individual project configurations are defined in project.json files inside the corresponding project directories.

Commands can be written in the form

npx nx <target> <project> [options]

or

npx nx run <project>:<target> [options]

Where <project> is the name specified in the project.json for a given project, and <target> is a key of the targets object in that same file.

All of the heavy lifting is done with purpose-built Nx plugins maintained by this project's primary contributor: