I'm working on a project that is going to be heavily templated, but the templates I'm creating might also work well in future projects as CodeSnippets for Visual Studio.
So, I was wondering, is there a way to access Visual Studio's system of loading, parsing, and displaying the CodeSnippets in any way, shape, or form?
For example, it would be really slick to be able to do something like this:
var snippet = LoadSnippet("~/path/to/code.snippet");
if (snippet != null)
{
snippet.TryReplace("$token$", "Some Value");
// and then do something with snippet.ToString(), or...
Console.WriteLine(snippet.GetCSharpString());
}
I know I could just load the .snippet files as XML and manipulate them manually, but in terms of taking advantage of the other things it does such as fill in default token values, execute functions to replace tokens, or control the editability of the tokens in the snippet file, that's more work than I want to duplicate if I don't have to.
Ideas?
Thanks!