I’m currently writing my own Source generator which can become a challenge when you start to create more complex constructs. One of the tools that helped me during the process was RoslynQuoter.
RoslynQuoter is a tool that for a given C# program shows the syntax factory API calls to construct its syntax tree.
You can try it out live at: http://roslynquoter.azurewebsites.net.
Nice!
More information
Source Generators - C# | Microsoft Learn
roslyn/docs/features/source-generators.cookbook.md at main · dotnet/roslyn (github.com)
roslyn-sdk/samples/CSharp/SourceGenerators at main · dotnet/roslyn-sdk (github.com)