Code snippet commands/Directives

S

steve.falzon@

Hi

I've been searching high and low for this info but have been
unsuccessful so far. I wonder if anybody knows where I can get a
specification for the directives contained within the code element of
a snippet.

I'm not looking for info on literals such as $SystemAttributeUsage$
which are described by Literal nodes and vary with each snippet but
info on directives such as $end$ which obviously signify the end of
something but it isn't clear what (there is no corresponding $begin$
for instance), and code can come after the $end$ statement as in the
snippet below.

The meaning of some is obvious eg, for a SurroundsWith snippet type
the $selected$ directive gives the code to be surrounded by the
snippet, many others aren't that obvious.

Any pointers to a spec would be greatly appreciated.

TIA
Steve

----------------
<Code Language="csharp"><![CDATA[
[$SystemAttributeUsage$($SystemAttributeTargets$.$target$, Inherited =
$inherited$, AllowMultiple = $allowmultiple$)]
sealed class $name$Attribute : $SystemAttribute$
{
// See the attribute guidelines at
//
http://msdn.microsoft.com/library/d.../cpgenref/html/cpconusingattributeclasses.asp
readonly string _positionalString;
int _namedInt;

// This is a positional argument.
public $name$Attribute (string positionalString)
{
this._positionalString = positionalString;

// TODO: Implement code here.
$end$throw new $Exception$("The method or operation is not
implemented.");
}
public string PositionalString
{
get
{
return this._positionalString;
}
}
// This is a named argument.
public int NamedInt
{
get
{
return this._namedInt;
}
set
{
this._namedInt = value;
}
}
}
]]>
</Code>
------------------------
 
J

Jani Järvinen [MVP]

Hi Steve,
I've been searching high and low for this info but have been
unsuccessful so far. I wonder if anybody knows where I can get a
specification for the directives contained within the code element of
a snippet.

I haven't found any official list of the pre-defined literals, but there are
several posts and links that I can provide to get you started. First, the
Code Snippet schema reference:

http://msdn2.microsoft.com/en-us/library/ms171418(VS.80).aspx

"Investigating Code Snippet Technology" by Andrew W. Troelsen:

http://msdn2.microsoft.com/en-us/library/ms379562(VS.80).aspx

VSEditor's WebLog, "Code Snippet - Schema Description":

http://blogs.msdn.com/vseditor/archive/2004/07/14/183189.aspx
...directives such as $end$ which obviously signify the end of
something but it isn't clear what...

The "$end$" literal means the location where the code editor cursor is
placed once the code snippet has been inserted.

Hope this helps!

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 
S

steve.falzon@

Hi Steve,


I haven't found any official list of the pre-defined literals, but there are
several posts and links that I can provide to get you started. First, the
Code Snippet schema reference:

http://msdn2.microsoft.com/en-us/library/ms171418(VS.80).aspx

"Investigating Code Snippet Technology" by Andrew W. Troelsen:

http://msdn2.microsoft.com/en-us/library/ms379562(VS.80).aspx

VSEditor's WebLog, "Code Snippet - Schema Description":

http://blogs.msdn.com/vseditor/archive/2004/07/14/183189.aspx


The "$end$" literal means the location where the code editor cursor is
placed once the code snippet has been inserted.

Hope this helps!

Hi Jani

Thanks for the info, very much appreciated.

Took a peek at your website, like your photos :)

Cheers
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top