public void Initialize(IncrementalGeneratorInitializationContext context) { var candidatesProvider = context.SyntaxProvider.CreateSyntaxProvider( (syntaxNode, _) => SourceGeneratorSyntaxReceiver.IsCandidate(syntaxNode), (syntaxContext, _) => (ClassDeclarationSyntax)syntaxContext.Node); var assemblyResolverProvider = context.AnalyzerConfigOptionsProvider.Select((provider, _) => new AssemblyResolver(provider.GlobalOptions)); var compilationProvider = context.CompilationProvider.Select((compilation, _) => compilation); var source = candidatesProvider .Collect() .Combine(assemblyResolverProvider) .Combine(compilationProvider) .Select((i, _) => (i.Left.Left, i.Left.Right, i.Right)); context.RegisterSourceOutput(source, Execute); }
public void IsCandidate(SyntaxNode syntaxNode, bool expected) { SourceGeneratorSyntaxReceiver.IsCandidate(syntaxNode).ShouldBe(expected); }