roslyn-sdk icon indicating copy to clipboard operation
roslyn-sdk copied to clipboard

Source Generator Sample Code Gen with Roslyn API

Open Marv51 opened this issue 4 years ago • 1 comments

Looking through all the sample in the repo related to source generators, they all seem to be based on a StringBuilder or similar sting based approach to constructing the generator source code.

I believe the roslyn sdk provides ways to generate C# code (SyntaxFactory, see also https://github.com/dotnet/roslyn/issues/43979)

Could somebody please add a sample (or update one) using these APIs? I believe they are recommended for a larger amount of generated source code.

Marv51 avatar Jan 22 '21 12:01 Marv51

After discovering: http://roslynquoter.azurewebsites.net/ - I now understand that pure SyntaxFactory alone is not a great way to go here. Any suggestions on a little bit higher level, more condensed API?

Marv51 avatar Jan 22 '21 12:01 Marv51