Cg syntax highlighting for VS .NET 2003?

Started by
5 comments, last by Drazgal 18 years, 10 months ago
Does anyone know how to enable syntax highlighting for Visual Studio .NET 2003 for .cg files? The Cg SDK includes a reg file and a .dat file that work for VS6, but they don't seem to do anything for VS .NET 2003. Thanks!
Advertisement
It involves changing the registry and other stuff...

Or you could try the VSTweak Power Toy (note I havn't tried this myself)
1. Open up regedit, and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Languages\File Extensions
2. Create a new key, and give it the name .cg
3. Select the .cpp key, and copy the value of the Default entry
4. Drop the value into the default entry of your newly created key

That should enable syntax highlighting and intellisence for .cg files. I'm not sure how to add the custom keywords for the cg language to the list of words to highlight. Maybe someone else can fill in that detail.
Gah, that was me. Haven't done that before.
I'm pretty sure you can add custom keywords by placing a .dat file in your VC.NET install Common7\IDE directory.

From what I've seen, it just needs to be a line-feed delimited list of keywords. However, I've no idea how it associates those keywords with your file extension.. and I couldn't dig anything up on a preliminary google search.
Alright, I got it all working with one problem: putting the usertype.dat file in so that I get the new Cg keywords also makes them keywords in .cpp files :(

I think I'll just edit the .dat file so that it doesn't have all the extranious stuff in it.

Thanks, guys!
Instead of mapping to the GUID for .cpp in the registry try using .fx instead since it has pretty much all of the keywords for .cg as it is.

This topic is closed to new replies.

Advertisement