Skip to main content
GameDev.net gamedev.net
🔒 Locked

HLSL syntax highlighting in Visual Studio 2005 Pro

Started by B_old Mar 25, 2007 at 7:14 AM 7 replies 16.3k views
Original Post
B_old
B_old
Hi, there was a discussion about this a little while ago. And I am curious about the current state. Has anybody figured out how to enable it?
devronious
devronious
Yes I would like to know as well, anybody know?
Asesh
Asesh
As far as I know Microsoft has permanently removed syntax highlighting in HLSL. If I remember it was removed starting either August or October 2006 SDK. However NVIDIA FX composer has a much better development environment for developing and debugging shaders
B_old
B_old
Quote:
Original post by Asesh
As far as I know Microsoft has permanently removed syntax highlighting in HLSL. If I remember it was removed starting either August or October 2006 SDK.

Why would they do such a thing?
Asesh
Asesh
Ask them :P
kelley
kelley
Here's how you can get syntax highlighting to work with any hlsl file extension that you use (.hlsl, .fx, .fxh, etc). Don't blame me if you screw up your registry!

Custom Syntax Highlighting


Here is what I did for Visual Studio 2005 (Professional Edition):

1. Open up the registry editor and go to the following location - HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\File Extensions
2. Copy the default value from the .cpp key.
3. Create a new key under the File Extensions with the name of .fx
4. Paste the value you just copied into the default value.
5. Restart Visual Studio and your shaders should now have syntax highlighting.
6. repeat steps 2-6 for the .fxh extension.

For Visual C++ Express Edition, follow the same steps. In step 2 use the following location:
HKLM\SOFTWARE\Microsoft\VCExpress\8.0\Languages\File Extensions


The method is based on this webpage, with minor changes:

http://community.livejournal.com/heos/3643.html
GambitSnax
GambitSnax
Hmmm that sounds to me like you are just duplicated the syntax highlighting for c++ and using it with any hlsl. And if that is the case there is an easier way to do it -

In visual studio 2005
- go to Tools -> Options
- choose Text Editor -> File Extensions
- you can then identify any unknown file extensions that you are using (eg. .fx or .hlsl) and pick which syntax highlighting system you want them to use.

At the moment my .fx ones are mimicking the c++ syntax highlighting, which isn't perfect, but its something at least. If anyone does figure out the proper hlsl highlighting please let us know :)

Cheers.
idloco
idloco
Quote:
Original post by GambitSnax
Hmmm that sounds to me like you are just duplicated the syntax highlighting for c++ and using it with any hlsl. And if that is the case there is an easier way to do it -

In visual studio 2005
- go to Tools -> Options
- choose Text Editor -> File Extensions
- you can then identify any unknown file extensions that you are using (eg. .fx or .hlsl) and pick which syntax highlighting system you want them to use.

At the moment my .fx ones are mimicking the c++ syntax highlighting, which isn't perfect, but its something at least. If anyone does figure out the proper hlsl highlighting please let us know :)

Cheers.

You have to download the CG Toolkit from the nVidia site.
Then in the folder \NVIDIA Corporation\Cg\msdev_syntax_highlighting\ its gonna be a file called usertype.dat then you will have to do this..

1. Copy the usertype.dat file to \Microsoft Visual Studio 8\Common7\IDE
2. Open up the registry editor and go to the following location - HKLM\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\File Extensions
3. Copy the default value from the .cpp key.
4. Create a new key under the File Extensions with the name of .cg
5. Paste the value you just copied into the default value.
6. Restart Visual Studio and your shaders should now have syntax highlighting.

and it will be all set.
------------------------------------ IDLoco Game Studios

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.