Is there any way to get syntax highlighting (and maybe something like "Format Document") for fx files in visual studio 2010 ? It is quite hard to debug more complex HLSL shader code without it. I know I could use fx composer but I would rather not switch between different dev-environments :-) Furthermore, I frequently use #region pragmas in VS2010. Is there something similar for editing HLSL shader code in VS2010?
Asked
Active
Viewed 1,592 times
1 Answers
5
You should have a look to the NShader project on CodePlex. It's an extension for Visual Studio 2010 that does just that: adding syntax highlighting for various shading languages.
Regarding the #region
pragmas, I think that a macro, as explained in this answer on SO, will do the trick. Here is another example also.

Community
- 1
- 1

Yannick Blondeau
- 9,465
- 8
- 52
- 74
-
Great, this seems to work nicely. Is there any equivalent for the region pragma? – ares_games Jan 25 '13 at 23:09
-
1Glad to help! I've edited my answer concerning the `#region` pragmas. – Yannick Blondeau Jan 26 '13 at 07:33
-
@Yannik: Thank! However, both plugins in that answer seem to not work with *.fx files but only with *.js files, do they? – ares_games Jan 26 '13 at 13:01
-
@pad_ares As comments are formatted the same way in HLSL and JS, the first macro should work with your `*.fx` files. You will have to use `//#region` instead of `#region` though. – Yannick Blondeau Jan 26 '13 at 13:42