This is NimbleMarkets' compatibility fork for
trippad,
based on upstream v0.9.11, commit 2a1ca310eb11b84989bcd93447969108b2f02555.
The maintained branch is trippad-v0.9.11; the patched release is
v0.9.11-trippad.1.
The patch tokenizes a leading minus as an operator. This fixes false argument
count/type errors in valid expressions such as smoothstep(0.0, 1.0, uv.x-0.1)
and nested mix calls. Unary negatives and signed exponents are covered by
lexer, parser, and semantic diagnostic regression tests. The server reports the
fork version through both --version and LSP initialization.
Release assets include native Apple Silicon and Intel macOS executables with a
SHA256SUMS file. Build and test from this branch with Rust 1.85.1:
cargo +1.85.1 test --locked --workspace
cargo +1.85.1 build --locked --release -p wgsl-analyzerFor macOS release builds, install the aarch64-apple-darwin and
x86_64-apple-darwin Rust targets, then add
--target aarch64-apple-darwin --target x86_64-apple-darwin to the build command.
The upstream extension-marketplace release workflow is disabled in this fork;
these standalone releases are published separately.
Trippad's installer pins the release and verifies the artifact hash. Its live integration tests check syntax/type errors, completion, starter shaders, and unspaced subtraction against the actual renderer's WGSL validator. This fork retains v0.9.11's analysis behavior and limitations; it is not a backport of newer upstream releases.
wgsl-analyzer is a language server plugin for the WGSL Shading language.
It comes with a VS Code plugin located in ./editors/code. Due to the nature of the language server protocol, it should be possible to create plugins for other editors as well.
The extension is published on the marketplace, so you can simply download the extension like any other.
If you are not using a platform for which the vscode extension ships prebuilt binaries (currently only windows-x64, linux-x64 and macos-x64), then you need to compile the language server yourself:
cargo install --git https://github.com/wgsl-analyzer/wgsl-analyzer.git wgsl-analyzerSpecify the server path in the settings:
{
"wgsl-analyzer.server.path": "~/.cargo/bin/wgsl-analyzer"
}- Requires CoC to be installed: https://github.com/neoclide/coc.nvim
- Requires cargo to be installed to build binaries:
-
Install the language server
cargo install --git https://github.com/wgsl-analyzer/wgsl-analyzer.git wgsl-analyzer
(if you are not familiar with using and setting up cargo, you might run into problems finding your binary. Ensure that $HOME/.cargo/bin is in your $PATH. More Info about $PATH: https://linuxconfig.org/linux-path-environment-variable)
-
open Neovim / Vim and type
:CocConfigto configure coc.nvim. -
under
.languageserver: { ... }create a new field named"wgsl". The field should look like this: -
In order for your editor to recognize WGSL files as such, you need to put this into your
vim.rc" Recognize wgsl au BufNewFile,BufRead *.wgsl set filetype=wgsl
-
Install the
wgsl-analyzerlanguage server -
Configure the
"wgsl"filetypevim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { pattern = "*.wgsl", callback = function() vim.bo.filetype = "wgsl" end, })
-
Configure the nvim lsp
local lspconfig = require('lspconfig') lspconfig.wgsl_analyzer.setup({})
- Assumes you are using
wgsl-mode: https://github.com/acowley/wgsl-mode
-
Install the language server
cargo install --git https://github.com/wgsl-analyzer/wgsl-analyzer wgsl-analyzer
-
Add the following to your init.el
(with-eval-after-load 'lsp-mode (add-to-list 'lsp-language-id-configuration '(wgsl-mode . "wgsl")) (lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection "wgsl-analyzer") :activation-fn (lsp-activate-on "wgsl") :server-id 'wgsl-analyzer)))
Configuration for the VS Code plugin can be found in its subdirectory: ./editors/code/README.md.
The lsp server can be built using cargo build --release -p wgsl-analyzer.
The vscode extension can either be built as a platform-specific extension which bundles the language server binary, or as a platform-independent one.
Install node modules:
cd editors/code && npm install
Platform independent extension:
cd editors/code && npm run package
Platform-specific extension:
Copy the server binary (either wgsl-analyzer or wgsl-analyzer.exe) into ./editors/code/out/, then run:
npm run package -- --target <target> -o wgsl-analyzer-<target>.vsixwhere the target is one of the targets listed as platform-specific extension targets.
This can be done automatically with cargo run --bin package -- --target linux-x64 --install.
The design is heavily inspired (and in large parts copied from) rust-analyzer.
See wgsl-analyzer architecture for a summary of the architecture.
(Also see rust-analyzer architecture for a summary of the original architecture.)
The extension gets automatically packaged and released to the marketplace in CI.
- update version in
package.json - run
./tools/update_version.sh - commit and tag with
vx.y.z git push && git push --tags