views:

760

answers:

2

Is there a way to define code snippets for another language, other then the default ones (C#, VB ...) in VS 2008 ? I'm using Intel's fortran compiler with Visual studio, and its integration in it is pretty complete apart from the code snippets part. I thought I read somewhere on msdn that you can't define new ones, for other languages.

So I would be really glad if someone could prove me otherwise.

Any help appreciated.

+1  A: 

Check out this article on VS and Code Snippets. It was written for VS2005 but is the same for VS2008.

Code Snippets

You should be able to use this with fortran since you specify the code language in an xml file that's used for the snippets.

Noah
I copied the prop.snippet from Visual C# directory, and just changed the language attribute in it to "fortran". Visual studio, upon importing gave an error:C:\My Documents\new.snippet: Missing or unspecified Language attributeAm I missing something ? All suggestions appreciated.
ldigas
+1  A: 

Code Snippet support for a language is determined by the language service. The Intel Fortran package does not support code snippets and it cannot be added by anyone else (through an add-in or 3rd party package).

The registry key that governs code snippet support is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Languages\CodeExpansions. You'll notice underneath this key there are subkeys for Basic, CSharp and XML (and maybe more if you have other language services that support code snippets) but no subkey for Fortran.

The only thing you can do is make a feature request to Intel and maybe they'll add code snippet support in a few years.

Stephen Martin
Not a great comfort, but at least I won't think about it anymore. Thanks Stephen !
ldigas