This issue collects the feedback shared on the incremental generator API in a recent review of the implementation for Razor.
Add option for Single on IncrementalValuesProvider Implemented.
Instead of using Collect() and Single() on an IncrementalValuesProvider, having a Single extension method to indicate that a provider can only ever have a single value would be helpful.
Add top-level MetadataReferencesProvider Closed via #55052
Provide a shortcut to compilation.References so that unnecessary transforms don't need to happen if the only thing we need from the compilation is the References.~~
Missing API: add support for determining whether an incremental source generator should run
Razor needs to be able to prevent the source generator from running under certain contexts (e.g. when VS is using EnC) but this isn't currently supported well.
We can do:
context.RegisterSourceOutput(foo, (context, source) => {
if (shouldRun) {
context.AddSource(...)
}
});
But that would still run all the intermediary steps before context.RegisterSourceOutput and waste cycles.
Missing API: add support from reporting diagnostics out of intermediary steps
We want to be able to report diagnostics out of intermediary steps, such as if certain metadata wasn't read out of the editor config.
Add provider for detecting declaration/method body changes in sources
We need a way to determine if a code modification affected only the declared types instead of their implementation. This will aid when discovering tag helpers from the current compilation. If definitions haven't changed, we don't need to recompute the tag helpers.
This issue collects the feedback shared on the incremental generator API in a recent review of the implementation for Razor.
Add option forImplemented.SingleonIncrementalValuesProviderInstead of using
Collect()andSingle()on anIncrementalValuesProvider, having aSingleextension method to indicate that a provider can only ever have a single value would be helpful.Add top-levelClosed via #55052MetadataReferencesProviderProvide a shortcut to
compilation.Referencesso that unnecessary transforms don't need to happen if the only thing we need from the compilation is theReferences.~~Missing API: add support for determining whether an incremental source generator should run
Razor needs to be able to prevent the source generator from running under certain contexts (e.g. when VS is using EnC) but this isn't currently supported well.
We can do:
But that would still run all the intermediary steps before
context.RegisterSourceOutputand waste cycles.Missing API: add support from reporting diagnostics out of intermediary steps
We want to be able to report diagnostics out of intermediary steps, such as if certain metadata wasn't read out of the editor config.
Add provider for detecting declaration/method body changes in sources
We need a way to determine if a code modification affected only the declared types instead of their implementation. This will aid when discovering tag helpers from the current compilation. If definitions haven't changed, we don't need to recompute the tag helpers.