protected override void Execute(ExecutionContext context, Snippet snippet)
        {
            snippet.SuffixShortcut("x");
            snippet.SuffixTitle(" definition");
            snippet.SuffixDescription(" definition");
            snippet.SnippetTypes |= SnippetTypes.SurroundsWith;
            snippet.SuffixFileName("Definition");
            snippet.AddTag(KnownTags.ExcludeFromReadme);

            PlaceholderCollection placeholders = snippet.Code.Placeholders;

            if (placeholders.Contains("_definition"))
            {
                snippet.CodeText = snippet.Code.ReplacePlaceholders("_definition", @" {
	$selected$$end$
}");
            }
        }
Exemple #2
0
        protected override void Execute(ExecutionContext context, Snippet snippet)
        {
            snippet.SuffixTitle(" declaration");
            snippet.SuffixDescription(" declaration");
            snippet.SuffixFileName("Declaration");

            PlaceholderCollection placeholders = snippet.Code.Placeholders;

            if (placeholders.Contains("_definitionStart"))
            {
                int index    = placeholders.Find("_definitionStart").Index - 1;
                int endIndex = placeholders.Find("_definitionEnd").EndIndex + 1;

                string s = snippet.CodeText;

                s = s.Insert(endIndex, ";");
                s = s.Remove(index, endIndex - index);

                snippet.CodeText = s;
            }

            snippet.AppendCode(snippet.Delimiter + Placeholder.EndIdentifier + snippet.Delimiter);
        }