This is a vscode extension allowing syntax highlighting, linting & symbol providing for HLSL / GLSL / WGSL shaders. It is using shader-language-server to lint shaders using common validator API & parse symbols for some code inspection.
Currently, it support some features and languages:
- Syntax Highlighting: Provide improved syntax highlighting for code.
- Diagnostic: Provide errors & warning as user type code.
- Symbol provider: provide goto, completion, hover & signature.
- Local symbols: Provide all user created symbols (function, constant, types...).
- Intrinsics symbols: Provide all languages provided intrinsics symbols.
Language | Syntax Highlighting | Diagnostics | Local symbols | Intrinsics symbols |
---|---|---|---|---|
GLSL | ✅ | ✅(glslang) | ✅ | ✅ |
HLSL | ✅ | ✅(DXC) | ✅ | ✅ |
WGSL | ✅ | ✅(Naga) | ❌ | ❌ |
This extension provide improved syntax highlighting for HLSL, GLSL & WGSL than the base one in VS code.
You cant lint your code in real time through this extension:
- GLSL relies on Glslang.
- HLSL relies on DirectX shader compiler on desktop, Glslang on the web (see below).
- WGSL relies on Naga.
The extension will suggest you symbols from your file and intrinsics as you type.
View available signatures for your function as you type it.
View informations relative to a symbol by hovering it.
Go to your declaration definition by clicking on it.
This extension contributes the following settings:
shader-validator.validate
: Enable/disable validation with common API.shader-validator.symbols
: Enable/disable symbol inspection & providers.shader-validator.severity
: Select minimal log severity for linting.shader-validator.includes
: All custom includes for linting.shader-validator.defines
: All custom macros and their values for linting.
shader-validator.hlsl.shaderModel
: Specify the shader model to target for HLSLshader-validator.hlsl.version
: Specify the HLSL versionshader-validator.hlsl.enable16bitTypes
: Enable 16 bit types support with HLSL
shader-validator.glsl.targetClient
: Specify the OpenGL or Vulkan version for GLSLshader-validator.glsl.spirvVersion
: Specify the SPIRV version to target for GLSL
This extension is supported on every platform, but some limitations are to be expected on some:
- Windows: full feature set.
- Mac & Linux: Rely on WASI version of server, same as web, see web support for limitations.
This extension run on the web on vscode.dev. It is relying on the WebAssembly Execution engine. Because of this restriction, we can't use dxc on the web as it does not compile to WASI and instead rely on glslang, which is more limited in linting (Only support some basic features of SM 6.0, while DXC support all newly added SM (current 6.8)).
This extension is based on a heavily modified version of PolyMeilex vscode-wgsl