Skip to content

2.0.0

Compare
Choose a tag to compare
@ByronMayne ByronMayne released this 17 Feb 02:29
· 43 commits to master since this release
627f33c

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");
       }
    }
}