Here is the XML code for a sample SurroundsWith snippet. In this example, the SUBSTRING SQL function will be inserted around the selected text in the SQL editor window prompting the user for first character index and number of characters.
NOTE - This sample is also included in the example snippet.xml file that is created in the users snippets folder upon first use of snippets within AtanaSuite.
<?xml version="1.0" encoding="utf-8" ?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>SUBSTRING</Title> <Description>Extracts a portion of a string.</Description> <Author>Atanasoft</Author> <SnippetTypes> <SnippetType>SurroundsWith</SnippetType><!-- Expansion inserts new text at the caret; SurroundsWith places new text before and after the selection --> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal> <ID>start</ID> <Default>1</Default> <ToolTip>The index of the first character to return.</ToolTip> </Literal> <Literal> <ID>length</ID> <Default>1</Default> <ToolTip>The number of characters to return.</ToolTip> </Literal> </Declarations> <!-- The following tokens can be used in the Code element below: $literal ID$ - The ID of a literal defined in the Declarations section above. If a literal is referenced multiple times, the first instance is editable and the value will be applied to all locations. $selected$ - The selected text in the editor at the time a SurroundsWith snippet was inserted. $end$ - The location for the caret after completion. --> <Code Language="sql"> <![CDATA[SUBSTRING($selected$, $start$, $length$)$end$]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets>