2.0.0
With new release I have changed the implementation of the source generator. You now need to apply the [SgsGenerator]
attribute to your class and add a constructor.
namespace Example
{
// IncrementalGenerator, is a generated type from `SourceGenerator.Foundations'
[SgfGenerator]
public class ExampleSourceGenerator : IncrementalGenerator
{
// Constructor can only take two arguments in this order
public ExampleSourceGenerator(
IGeneratorEnvironment generatorEnvironment,
ILogger logger) : base("ExampleSourceGenerator",
generatorPlatform, logger)
{
}
// SgfInitializationContext is a wrapper around IncrementalGeneratorInitializationContext
protected override void OnInitialize(SgfInitializationContext context)
{
// Attaches Visual Studio debugger without prompt
AttachDebugger();
// Writes output to Visual Studios output window
WriteLine("Hello World");
}
}
}