A Visual Studio extension that provides enhanced support for editing High Level Shading Language (HLSL) files.
See the changelog for changes and roadmap.
Since Visual Studio 2012, Visual Studio has shipped with basic support for editing HLSL files. In addition to that basic feature set, HLSL Tools includes many more navigational and editing features:
| VS2015 / VS2017 | VS2015 / VS2017 with HLSL Tools |
|---|---|
| Syntax highlighting | Syntax highlighting |
| Automatic formatting | Automatic formatting |
| Brace matching | Brace matching |
| Brace completion | Brace completion |
| Outlining | Outlining |
| Statement completion | |
| Signature help | |
| Reference highlighting | |
| Navigation bar | |
| Navigate to (Ctrl+,) | |
| Live errors | |
| Go to definition | |
| Quick info | |
| Gray out code excluded by preprocessor | |
| HLSL-specific preferences |
There are more features on the roadmap.
Just start typing, and HLSL Tools will show you a list of the available symbols (variables, functions, etc.) at that location. You can manually trigger this with the usual shortcuts: Ctrl+J, Ctrl+Space, etc.
Signature help (a.k.a. parameter info) shows you all the overloads for a function call, along with information (from MSDN) about the function, its parameters, and return types. Typing an open parenthesis will trigger statement completion, as will the standard Ctrl+Shift+Space shortcut. Signature help is available for all HLSL functions and methods, including the older tex2D-style texture sampling functions, and the newer Texture2D.Sample-style methods.
Placing the cursor within a symbol (local variable, function name, etc.) will cause all references to that symbol to be highlighted. Navigate between references using Ctrl+Shift+Up and Ctrl+Shift+Down.
HLSL Tools supports Visual Studio's Navigate To feature. Activate it with Ctrl+,, and start typing the name of the variable, function, or other symbol that you want to find.
HLSL Tools shows you syntax and semantic errors immediately. No need to wait till compilation! Errors are shown as squigglies and in the error list.
Press F12 to go to a symbol definition. Go to definition works for variables, fields, functions, classes, macros, and more.
Hover over almost anything (variable, field, function call, macro, semantic, type, etc.) to see a Quick Info tooltip.
HLSL Tools evaluates preprocessor directives as it parses your code, and grays out excluded code. If you want to make a code block visible to, or hidden from, HLSL Tools, use the __INTELLISENSE__ macro:
Configure HLSL-specific IntelliSense and formatting options. If you really want to, you can disable IntelliSense altogether and just use HLSL Tools' other features. You can also set HLSL-specific highlighting colours in Tools > Options > Environment > Fonts and Colors.