GLSL IntelliSenseSmart GLSL editing for VS Code: completion that writes your
A language server for every kind of GLSL: OpenGL, Vulkan, WebGL and three.js, include-based libraries such as LYGIA, Shadertoy, or your own engine.
It works out of the box. Works with desktop GLSL up to 4.60 · Vulkan GLSL · GLSL ES 1.00 / 3.00 (WebGL 1 / 2) · three.js · LYGIA and other FeaturesHover docs from your own commentsHover a function, struct, macro or uniform to see every overload, its documentation and where it is defined. Plain
Completion that writes the
|
| System | Command |
|---|---|
| Debian / Ubuntu | sudo apt install glslang-tools |
| Arch | sudo pacman -S glslang |
| Fedora | sudo dnf install glslang |
| macOS | brew install glslang |
| Windows | the Vulkan SDK, or MSYS2 pacman -S mingw-w64-x86_64-glslang |
If it is not on your PATH, set glslLsp.diagnostics.glslang.path.
Optional: #include looks in the including file's folder and then in the workspace folder roots, so #include "lygia/..." works without setup. For libraries elsewhere, add their folder to glslLsp.includePaths (searched before the workspace roots). See Includes.
The server is plain TypeScript bundled with the extension. There is no native binary, so it runs on Windows, macOS and Linux on any CPU, locally or over Remote.
Use it with your engine or framework
If your runtime provides uniforms or macros the shader does not declare, tell the extension about them. They then behave like builtins: hover, completion, highlighting, no undeclared-name reports, and declarations for glslangValidator.
// .vscode/settings.json
{
"glslLsp.environment.uniforms": [
{ "name": "u_time", "type": "float", "doc": "Seconds since start." },
{ "name": "u_lights", "type": "vec4[8]", "doc": "Light positions (xyz) and radius (w)." }
],
"glslLsp.environment.defines": { "MAX_LIGHTS": "8" }
}
More: Environment in docs/configuration.md
Shadertoy (optional)
Shadertoy-style files are recognized automatically: iTime, iResolution, iChannel0-3 and mainImage are known, and mainImage shaders are validated inside a generated main(). The directives of the shader-toy extension (#iChannel, #iUniform, #iKeyboard) are understood too. That extension is not required; when it is installed, a preview button appears in the editor title bar.
More: Shadertoy in docs/configuration.md
Settings
| Setting | Default | What it does |
|---|---|---|
glslLsp.includePaths |
[] |
Extra folders searched by #include |
glslLsp.diagnostics.glslang.enable |
true |
Run glslangValidator for compiler errors |
glslLsp.diagnostics.glslang.path |
glslangValidator |
Path to the validator |
glslLsp.environment.uniforms |
[] |
Uniforms your runtime provides |
glslLsp.environment.defines |
{} |
Macros your runtime defines |
glslLsp.environment.presets |
[] |
["three.js"] for three.js shaders |
glslLsp.shadertoy.enable |
auto |
Where Shadertoy support applies: auto, on or off |
glslLsp.format.mode |
conservative |
conservative, opinionated or off |
glslLsp.inlayHints.parameterNames |
literals |
none, literals or all |
All 25 settings and every command are in docs/configuration.md, or search @ext:pablodegroot.glsl-intellisense in the Settings editor.
FAQ
It says glslangValidator was not found
Compiler checks are on by default, but the tool is optional. Install it with one of the commands in Quick start and run GLSL: Restart Language Server, or set glslLsp.diagnostics.glslang.path to its location. The notice also lets you turn compiler checks off or never see it again. Everything else works without it.
Only complete shaders are compiled: a file with main() and a #version line, or a mainImage shader with Shadertoy support. Other files get the fast checks only. See docs/diagnostics.md.
Does it work with Vulkan GLSL?
Yes. A shader that uses Vulkan-only GLSL (layout(set = ...), push_constant, subpassInput, gl_VertexIndex, ...) is compiled with Vulkan rules, everything else with OpenGL rules. To choose yourself, set glslLsp.diagnostics.glslang.targetEnv to opengl or vulkan1.0 to vulkan1.3. Ray tracing, mesh and task shaders are not supported yet. See Vulkan GLSL.
three.js shaders report position, projectionMatrix and #include <common>
three.js adds those names and chunks when it compiles a ShaderMaterial. Turn on the three.js preset:
"glslLsp.environment.presets": ["three.js"]
The uniforms and attributes three.js always adds then behave like builtins, and #include <chunk> lines are not reported. Declare anything else your material adds in glslLsp.environment.uniforms. See three.js and other runtimes.
I have another GLSL extension installed
If it also provides diagnostics or completion, you will see duplicates. Disable that extension for the workspace, or turn off its validator. If both provide syntax highlighting, only one grammar is used, depending on the order the extensions load.
My .vs / .fs files are not recognized
.vsh, .fsh, .vshader, .fshader, .glslv, .glslf and the other common shader extensions are. .vs and .fs are also used by other languages (.fs is F#), so they are not claimed by default. Map them in your settings; the shader stage is still taken from the extension:
"files.associations": { "*.vs": "glsl", "*.fs": "glsl" }
Ctrl+Alt+Up/Down adds cursors instead of nudging (or the other way round)
In a GLSL editor these keys nudge only when the cursor is on a number. Otherwise they fall back to the platform's default (Add Cursor Above/Below on Windows). In Remote sessions from Windows the fallback may not apply. To use other keys, rebind the four GLSL: Increment/Decrement Number at Cursor commands in Keyboard Shortcuts (Ctrl+K Ctrl+S). Some Windows graphics drivers take Ctrl+Alt+Arrow for screen rotation before VS Code sees it.
How do I format on save?
"[glsl]": {
"editor.defaultFormatter": "pablodegroot.glsl-intellisense",
"editor.formatOnSave": true
}
See docs/formatting.md for the modes and rules.
Contributing
Bug reports and ideas are welcome in the issue tracker. To build, test or debug the extension, see CONTRIBUTING.md.
If the extension helps your shader work, a rating on the Marketplace helps other GLSL developers find it.