A Visual Studio 2019 / 2022 extension that provides enhanced support for editing High Level Shading Language (HLSL) files. See the changelog. Why use HLSL Tools?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:
FeaturesStatement completionJust 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: Signature helpSignature 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 Reference highlightingPlacing the cursor within a symbol (local variable, function name, etc.) will cause all references to
that symbol to be highlighted. Navigate between references using Navigation barNavigate ToHLSL Tools supports Visual Studio's Navigate To feature. Activate it with Live errorsHLSL Tools shows you syntax and semantic errors immediately. No need to wait till compilation! Errors are shown as squigglies and in the error list. Go to definitionPress F12 to go to a symbol definition. Go to definition works for variables, fields, functions, classes, macros, and more. Quick infoHover over almost anything (variable, field, function call, macro, semantic, type, etc.) to see a Quick Info tooltip. Preprocessor supportHLSL 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 OptionsConfigure 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. ExtrasThe codeHLSL Tools includes a handwritten HLSL parser. It initially used an ANTLR lexer and parser, but the handwritten version was faster, and offered better error recovery. HLSL Tools has a reasonable test suite - although it can certainly be improved. Amongst more granular tests, it includes a suite of 433 shaders, including all of the shaders from the DirectX and Nvidia SDKs. If you want to contribute gnarly source files which push HLSL to its limit, that would be great! Syntax visualizerInspired by Roslyn, HLSL Tools includes a syntax visualizer. It's primarily of interest to HLSL Tools developers,
but may be of interest to language nerds, so it's included in the main extension. Open it using Custom preprocessor definitions and additional include directoriesHLSL Tools will, by default, only use the directory containing the source file to search for You can customise this, and add additional preprocessor definitions, by creating a file named
HLSL Tools will look for a file named Config files are cached for performance reasons. If you make make changes to a config file, you'll need to close and re-open any source files that use that config file. Getting involvedYou can ask questions in our Gitter room. If you find a bug or want to request a feature, create an issue here . You can find me on Twitter at @_tim_jones_ and I tweet about HLSL Tools using the #hlsltools hashtag. Contributions are always welcome. Please read the contributing guide first. Maintainer(s)Acknowledgements
|