You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a source generator that implements IIncrementalGenerator and can report diagnostics. Then, I wrote a CodeFixProvider for such diagnostics, but the code actions do not show up.
I think I followed all the steps for implementing the code fix provider because another one I wrote works fine for diagnostics reported by a DiagnosticAnalyzer.
Is this not supported or is there something I missed?
I am using Visual Studio 17.5.1 with Roslyn 4.0.1 - I also tried version 4.5.0 but nothing changed.
The text was updated successfully, but these errors were encountered:
I don't see anything that woudl make this work. @mavasani i would only expect that we call into DiagnosticAnalyzers to get the diagnostics that a code fix can fix. Correct?
I'm in a situation where I need to gather contextual information from symbol analysis and then elaborate on these pieces of information both for generating source code and for reporting diagnostics, for which I wrote some code fixes.
I tried moving the analysis to a separate DiagnosticAnalyzer, but the diagnostic pipeline was composed of a Symbol action and a CompilationEnd action, which I have found it cannot run inside the IDE, let alone code fixing.
The workaround I'm using now is serializing the diagnostics produced by the generator to a generated file, which is then analyzed by a DiagnosticAnalyzer, which then reports the actual diagnostics. This works, but I find it a bit cumbersome and not the best for performance; better workarounds would be very welcomed :)
It would be very helpful if code fix providers could also fix generator-reported diagnostics.
mavasani
changed the title
Question: CodeFixProvider for diagnostics reported by IIncrementalGenerator
CodeFixProvider for diagnostics reported by IIncrementalGenerator
Apr 25, 2023
mavasani
added a commit
to mavasani/roslyn
that referenced
this issue
Apr 25, 2023
I wrote a source generator that implements IIncrementalGenerator and can report diagnostics. Then, I wrote a CodeFixProvider for such diagnostics, but the code actions do not show up.
I think I followed all the steps for implementing the code fix provider because another one I wrote works fine for diagnostics reported by a DiagnosticAnalyzer.
Is this not supported or is there something I missed?
I am using Visual Studio 17.5.1 with Roslyn 4.0.1 - I also tried version 4.5.0 but nothing changed.
The text was updated successfully, but these errors were encountered: