Run a single generator at a time #74086
Labels
api-approved
API was approved in API review, it can be implemented
Area-Compilers
Concept-API
This issue involves adding, removing, clarification, or modification of an API.
Feature Request
New Feature - Source Generators
Source Generators
untriaged
Issues and PRs which have not yet been triaged by a lead
Milestone
Background and Motivation
Today the generator driver only has the ability to run all generators it contains. As part of the razor cohosting work we would like the ability to only update a single generator (the razor generator in this case).
While we could remove the existing generators, run the driver, and then re-add them, this throws away any saved state associated with the removed generators meaning subsequent runs would not be incremental.
Proposed API
namespace Microsoft.CodeAnalysis { public abstract class GeneratorDriver { public GeneratorDriver RunGenerators(Compilation compilation, CancellationToken cancellationToken = default) + public GeneratorDriver RunGenerator(ISourceGenerator generator, Compilation compilation, CancellationToken cancellationToken = default) } }
Usage Examples
Open question: What happens if generator passed to
RunGenerator
isn't part of the driver? Exception, or just nothing happens?Alternative Designs
The text was updated successfully, but these errors were encountered: