Skip to content

Type to search extensions

Shader Language Server

v0.2.0

Shader validation, diagnostics and language features for HLSL, GLSL and WGSL, powered by shader-language-server (antaalt/shader-sense).

Updated 3 months ago
45k downloads 3 stars Repository ↗

Shader Language Server for Zed

A Zed extension providing shader validation and language features for HLSL, GLSL and WGSL, powered by shader-language-server (antaalt/shader-sense).

Features

  • Real-time diagnostics (dxc for HLSL, glslang for GLSL, naga for WGSL)
  • Completion, hover, goto definition and document/workspace symbols
  • Document formatting (clang-format)
  • Preprocessor-aware analysis with custom includes, defines, and per-stage defines

Supported Languages & File Types

Language Extensions
HLSL .hlsl .hlsli .fx .fxh .ush .usf
GLSL .glsl .vert .frag .comp .geom .tesc .tese .mesh .task
WGSL .wgsl

Installation

Search for Shader Language Server on the Zed extension registry.

Language Server Binary

The extension resolves the server binary in this order:

  1. An explicit path in lsp.shader-language-server.binary.path.
  2. A shader-language-server executable found on $PATH.
  3. A previously downloaded copy cached by the extension.
  4. A fresh download of the latest antaalt/shader-sense release.

Prebuilt binaries are available for Windows x86_64, Windows aarch64, and Linux x86_64. On other platforms, build the server from source and place it on your $PATH or set lsp.shader-language-server.binary.path.

Configuration

All settings live under lsp.shader-language-server.settings in your Zed settings.json. The full settings blob is passed to the server at startup via --config and also forwarded in response to workspace/configuration requests.

{
  "lsp": {
    "shader-language-server": {
      "settings": {
        // --- Common ---
        "validate": true,
        "symbols": true,
        "symbolDiagnostics": false,
        "severity": "info",       // "none" | "error" | "warning" | "info" | "hint"
        "includes": [],           // additional include search paths
        "defines": {},            // preprocessor defines: { "MY_MACRO": "1" }
        "stageDefine": {          // per-stage preprocessor defines
          "vertex": {},
          "fragment": {},
          "compute": {}
          // geometry | tesselationControl | tesselationEvaluation | mesh | task
          // rayGeneration | closestHit | anyHit | callable | miss | intersect
        },
        "pathRemapping": {},
        "configOverride": "",

        // --- HLSL ---
        "hlsl": {
          "enabled": true,
          "shaderModel": "ShaderModel6_8",
          "version": "V2021",
          "enable16bitTypes": false,
          "spirv": false
        },

        // --- GLSL ---
        "glsl": {
          "enabled": true,
          "targetClient": "Vulkan1_3",
          "spirvVersion": "SPIRV1_6",
          "preamble": ""
        },

        // --- WGSL ---
        "wgsl": {
          "enabled": true
        }
      }
    }
  }
}

The full list of accepted keys and values is in package.json of the upstream VS Code extension.

Disabling individual languages

Setting hlsl.enabled, glsl.enabled, or wgsl.enabled to false omits the corresponding --hlsl / --glsl / --wgsl flag from the server invocation:

"settings": { "wgsl": { "enabled": false } }

Binary overrides

Use the binary block to override the executable, arguments, or environment:

"lsp": {
  "shader-language-server": {
    "binary": {
      "path": "/path/to/shader-language-server",
      "arguments": ["--stdio", "--hlsl", "--glsl"],
      "env": { "RUST_LOG": "shader_language_server=debug" }
    }
  }
}

When arguments is set the extension uses it verbatim, skipping the automatic --config and language flags.

Credits

License

MIT

ZedExt An unofficial community project. Not affiliated with Zed Industries.

Data from Zed’s extension registry and GitHub · updated