Game Development Community

dev|Pro Game Development Curriculum

Enable syntax highlighting of Torque files in Visual Studio 7

by Mark Harmon · 05/12/2003 (9:43 am) · 9 comments

WARNING: If you use a version of VS .NET that includes the C# compiler, you may want to remove the line below that assigns C++ style syntax highlighting to .cs files.

Create a new text file on your desktop and open it up for editing.

Copy and paste the following lines if you use Visual Studio 7.0 (Visual Studio .NET):
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio.0\Languages\File Extensions\.gui]
@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio.0\Languages\File Extensions\.mis]
@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio.0\Languages\File Extensions\.cs]
@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio.0\Languages\File Extensions\.hfl]
@="{58E975A0-F8FE-11D2-A6AE-00104BCC7269}"

Copy and paste the following lines if you use Visual Studio 7.1 (Visual Studio .NET 2003):


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio.1\Languages\File Extensions\.gui]
@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio.1\Languages\File Extensions\.mis]
@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio.1\Languages\File Extensions\.cs]
@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio.1\Languages\File Extensions\.hfl]
@="{58E975A0-F8FE-11D2-A6AE-00104BCC7269}"

Now save the file. Rename it to shft.reg
Double-click the shft.reg file and answer yes to dialog asking if you are sure you want to add the lines to the registry.

Now set your file associations for those files to be opened by Visual Studio and you are done.


Edited: I added the hfl file after posting this. I made it's syntax highlighting the same as xml.

Edited: It's important that the formatting be exactly as shown. The line with @ must be below the [HKEY.. line.

#1
05/14/2003 (4:19 am)
It might be better to just upload a .reg file. With the text being wrapped in the box, it won't work right when it's pasted out of the browser.
#2
05/14/2003 (11:32 am)
Shoot, I didn't know that would cause problems. Too late to upload now, since I chose to do this as a how-to rather than a code resource. This file is sitting on my hard drive. I will email it to anyone that asks.
#3
05/18/2003 (12:27 am)
Won't adding different syntax highlighting for .cs files screw up VS .Net's highlighting of C# code?
#4
05/18/2003 (10:44 am)
Judah: If the .cs file extension is registered as being a C# file by the VS .NET installer, then yes.

I have the Standard edition of VS .NET and there is no C# support so it doesn't cause any problems for me. I will add a warning to the resource.
#5
05/18/2003 (12:53 pm)
You mean you have only Visual C++ .Net, not the entire Visual Studio package.
#6
05/19/2003 (8:39 am)
Right. Visual C++ .net
#7
01/15/2006 (10:56 pm)
Any chance this can be updated to work with vs.net 2005? =)
#8
01/26/2006 (6:47 pm)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress.0\Languages\File Extensions\.gui]
@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress.0\Languages\File Extensions\.mis]
@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress.0\Languages\File Extensions\.cs]
@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"

This will enable syntax highlighting for VCExpress.
If you want to get VC# express then change the VCExpress to VCSExpress in the path above.


Standard disclaimer: Your registry gets screwed up, Don't blame me after you spend hours trying to fix it, then fail, then spend hours reinstalling Windows ;D
#9
06/14/2006 (3:40 pm)
This was so helpful I had to join this site just to say thankyou.

I wanted to associate a .kon suffix (Yahoo Widget engine) with the xml editor in VS.NET as they are xml files in disguise.

I just stole the last line out of you 7.0 example, and it worked a treat.

I did take an XP system recovery point first, and I would recommend this.

Once again, many thanks.