Hi,
There are two ways to customize code snippets.
1. Add code snippet from code like this:
CodeSnippet snippet = new Alternet.Syntax.CodeCompletion.CodeSnippet();
snippet.Code = new CodeSnippetCode();
snippet.Header = new CodeSnippetHeader();
snippet.Header.Author = "Your";
snippet.Header.Description = "My custom class snippet";
snippet.Header.Title = "my custom class";
ICodeSnippetType type1 = new CodeSnippetType();
type1.SnippetType = SnippetType.Expansion;
snippet.Header.Types.Add(type1);
ICodeSnippetType type2 = new CodeSnippetType();
type2.SnippetType = SnippetType.SurroundsWith;
snippet.Header.Types.Add(type2);
snippet.ImageIndex = 64;
ICodeSnippetDeclaration decl = new CodeSnippetDeclaration();
ICodeSnippetLiteral literal = new CodeSnippetLiteral();
literal.ID = "name";
literal.ToolTip = "Class name";
literal.Default = "MyCustomClass";
decl.Literals.Add(literal);
snippet.Declarations.Add(decl);
snippet.Code.Delimiter = "$";
snippet.Code.Code = @"class $name$
{
private int customField;
$selected$$end$
}";
csParser1.CodeSnippets.Add(snippet);
2. Load code snippets from xml file like this:
csParser1.CodeSnippets.LoadFile(@"C:\Test\CSharpSnippets.xml");
I've uploaded CSharpSnippets.xml here:
https://drive.google.com/file/d/1fZgOQ-fmIy77zJCJrqRPgwL-vJYUJwi-/view?usp=sharing
Kind regards,
Andrew Medvedev