Add Syntax Highlighting to Additional File Extensions in Visual Studio 2005
I have been working with lot of SQL scripts lately, most of them files with the default extensions given by SQL Server’s export functionality (e.g. stored procedure scripts end in .prc, views end in .viw, triggers end in .trg, etc.). By default, Visual Studio 2005 doesn’t do any syntax highlighting of these files because it doesn’t recognize their extensions as SQL scripts/files.
Here is a procedure to turn on syntax highlighting for custom file extensions:
- Open regedit. (Click Start, Run…, type in regedit, and hit Enter or click the
OKbutton.) - Go to the
HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\8.0\Languages\File Extensionskey. - Click on the key for the file extension which maps to the syntax highlighting you want for your custom/new file extension. (In my case, I clicked on the
.sqlkey.) - Double-click the
(Default)value under the key, and copy its value. - Go back to the parent key (e.g. the
File Extensionskey from above), right-click and chooseNew > Key. Name the key with the custom/new file extension you want Visual Studio to syntax highlight. - Double-click the key’s
(Default)value and paste in the value from the original key’s(Default)value. - Done! Open a file with your extension in Visual Studio 2005 and witness the syntax highlighting goodness.
