wgsl-analyzer is a language server plugin for the WGSL Shading language.
It comes with a VS Code plugin located in ./editors/code, but 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 wgsl_analyzer
Specify the server path in the settings:
{
"wgsl-analyzer.server.path": "~/.cargo/bin/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-independant 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>.vsix
where the target is one of the targets listed as platform-specific extension targets.
The design is heavily inspired (and in large parts copied from) rust-analyzer. See rust-analyzer/docs/dev/architecture.md for a summary of the architecture.