Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Unity Shader ToolsNew to Visual Studio Code? Get it now.
Unity Shader Tools

Unity Shader Tools

xiake-1

|
1 install
| (0) | Free
Unity .shader/.hlsl language support (tree-sitter + LSP)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Unity Shader Tools

简体中文 | English

为 Unity 开发者打造的 VSCode 插件:让 .shader / .hlsl 文件拥有完整的语言智能——转到定义、补全、 重命名、悬停、语法与类型诊断、格式化。解析采用自研 tree-sitter ShaderLab 语法与 HLSL 方言支持, 类型检查调用随扩展附带的官方 dxc 编译器——开箱即用,无需安装任何外部工具。

功能 — ShaderLab(.shader)

  • 语法高亮(关键字、属性、Pass、语义)
  • 格式化文档(幂等,失败即不改):ShaderLab 外壳与 CGPROGRAM / HLSLPROGRAM / GLSLPROGRAM 内部 按块深度重排;行内空白规范化与行尾 } 拆行(各有开关)
  • 转到定义 / 速览定义(跨文件,跟随 #include,支持 CGIncludes 与 Unity 包路径)
  • 悬停查看定义(着色器名、属性、HLSL 符号;常见 Unity 内置函数经随包 CGIncludes 索引)
  • 查找所有引用
  • 重命名符号(着色器名,两步流程)
  • 补全(Fallback / UsePass 着色器名、#include 路径、. 后的 HLSL 成员)
  • 语法诊断 + 条件编译死分支灰化
  • DXC 类型诊断(按平台附带官方 dxc,无需安装)
  • 变体计数报告(含材质证据,命令面板)
  • 转换语言模式命令(与 Unity for VS Code 共存,不改用户设置)

功能 — HLSL(.hlsl / .hlslinc / .cginc)

  • 语法高亮与格式化(.cginc 全文同样排版)
  • 跨文件转到定义、悬停、查找所有引用
  • 补全(. 后成员、include 路径)

说明

  • 原生组件按平台随 vsix 附带:win32-x64/arm64、linux-x64/arm64、darwin-x64/arm64; 未覆盖的平台会明确报加载失败,而不是静默失去智能
  • 与 Unity for VS Code(VSTU)可共存:默认不改任何用户设置,需要时可用「转换语言模式」命令接管

源码与问题反馈:https://github.com/xiake-1/unity-shader-tools


简体中文 | English

A VSCode extension for Unity developers: full language intelligence for .shader / .hlsl files — go to definition, completion, rename, hover, syntax & type diagnostics, and formatting. Parsing runs on a custom tree-sitter ShaderLab grammar and HLSL dialect support; type checking calls the official dxc compiler bundled with the extension — works out of the box, nothing else to install.

Features — ShaderLab (.shader)

  • Syntax highlighting (keywords, properties, passes, semantics)
  • Document formatting (idempotent; never rewrites on failure) — ShaderLab shell plus CGPROGRAM / HLSLPROGRAM / GLSLPROGRAM bodies re-indented by block depth; intra-line whitespace normalization and trailing-} splitting (each with its own switch)
  • Go to definition / peek definition — cross-file, follows #include (Unity CGIncludes and package paths)
  • Hover definition info (shader names, properties, HLSL symbols; common Unity built-ins via the bundled CGIncludes index)
  • Find all references
  • Rename symbol (shader names, two-step prepare/rename)
  • Completion — shader names in Fallback / UsePass, #include paths, HLSL members after .
  • Syntax diagnostics + dead-branch graying for conditional compilation
  • DXC type diagnostics — official dxc bundled per platform (win32-x64/arm64, linux-x64, darwin-x64/arm64)
  • Variant count report with material evidence (command palette)
  • Convert language mode command — coexists with Unity for VS Code (VSTU) without touching user settings

Features — HLSL (.hlsl / .hlslinc / .cginc)

  • Syntax highlighting and formatting (.cginc files are formatted end-to-end as well)
  • Cross-file go to definition, hover, find all references
  • Completion (members after ., include paths)

Notes

  • Native modules ship inside the vsix per platform: win32-x64/arm64, linux-x64/arm64, darwin-x64/arm64; unsupported platforms fail loudly instead of silently losing intelligence
  • Coexists with Unity for VS Code (VSTU): no user settings are changed by default; use the "convert language mode" command when you want this extension to take over

Source & feedback: https://github.com/xiake-1/unity-shader-tools

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft