NeVeSpl / NTypewriter

File/code generator using Scriban text templates populated with C# code metadata from Roslyn API.
https://nevespl.github.io/NTypewriter/
MIT License
126 stars 24 forks source link

Incremental Generator #99

Open viceroypenguin opened 11 months ago

viceroypenguin commented 11 months ago

I've been using Scriban as my templating engine for a while, and I came across your live editor for Scriban files. I'd love to switch to your NTypewriter.SourceGenerator for some of my stuff, but I noticed that it is still dependent on ISourceGenerator.

Are there any plans to upgrade to IIncrementalGenerator? This would improve performance and the source generator to be done live instead of only at VS Load.

NeVeSpl commented 11 months ago

Rendering is done on every full build not only on VS load.

NTypewriter.SourceGenerator will never be upgraded to IIncrementalGenerator, more likely a new one called NTypewriter.IncrementalSourceGenerator will be added.

Keep in mind that right now in .nt templates users have access to every type from the project. To take advantage of IIncrementalGenerator, .nt templates would have to be per single type, and somehow be able to define a predicate to filter when IIncrementalGenerator should run.