extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Improve contextual options gen incrementality

Open Youssef1313 opened this issue 2 months ago • 0 comments

Current generator implementation doesn't follow Roslyn best practices, and can likely be very slow in big solutions while typing in IDE.

The PR isn't yet complete. All diagnostics produced by the generator needs to move to separate DiagnosticAnalyzer implementations. Before putting some time on it, I'd like to get an initial review and whether or not you are comfortable with the changes.

@CyrusNajmabadi @chsienki If you have time to take a high-level look on the changes here please.

Microsoft Reviewers: Open in CodeFlow

Few notes on the changes:

  • ContextReceiver was deleted. It was already dead code on main.
  • SymbolHolder and SymbolLoader were deleted. It was called in HandleAnnotatedTypes but was unnecessarily and not needed. ForAttributeWithMetadataName already gives us what we want. This was probably a left over from a transition from ISourceGenerator to IIncrementalGenerator.
  • Diagnostics in incremental generators are a nightmare and should never be done IMO. Moving to separate analyzers is far much better.
  • Symbols/compilations in generator pipeline models should always be avoided.
  • Generator pipeline models must implement equality properly.

Youssef1313 avatar Oct 20 '25 06:10 Youssef1313