Similar to Source Templates, it would be nice to be able to ship File Templates inside of source code projects and NuGet Packages. This would help OSS projects ship boilerplate code and light-up experiences inside of ReSharper and Rider.
I'm still not sure 100% how to define variables, but an array of comma delimited values might work. Here's an example of a file template defined in code.
using JetBrains.Annotations;
public static class MySourceTemplates
{
[FileTemplate(
DefaultFileName="ClassTests.cs",
Description = "Tests for $CLASS$",
Reformat=true,
ShortenQualifyingReferences=true,
Availability=new [] { "C# Projects", "F# Projects" },
AddToNewMenu=true,
Variables = new []
{
// Name, Macro, Editable (default false)
"HEADER,FileHeader",
"CLASS,Current File Name,true",
"NAMESPACE,"
})]
public static void xunit_test()
{
/*
$HEADER$namespace $NAMESPACE$
{
public class $CLASS$_TESTS {$END$}
}
*/
}
}
Similar to Source Templates, it would be nice to be able to ship File Templates inside of source code projects and NuGet Packages. This would help OSS projects ship boilerplate code and light-up experiences inside of ReSharper and Rider.
I'm still not sure 100% how to define variables, but an array of comma delimited values might work. Here's an example of a file template defined in code.