Merged
Conversation
…edit/1450689) This regression was introduced with async lightbulb performance improvement PR: dotnet#56959. With that PR, we now optimize/reduce the number of analyzers to execute in the "Normal" priority bucket for async light bulb. We earlier executed all analyzers in this bucket, but now only try to execute analyzers which report at least one diagnostic ID which has a corresponding code fix provider that can fix that diagnostic ID. To identify this reduced set of analyzers, we execute this newly added perf optimization to skip analyzers that don't have a code fix: https://github.com/dotnet/roslyn/blob/88f829939583d49d9e08104a71a7645d712bcfbc/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs#L151-L155 `_owner.DiagnosticAnalyzerInfoCache.GetDiagnosticDescriptors` call in this code is problematic for TS analyzers, because these are not regular DiagnosticAnalyzer sub-types, but instead derive from our internal DocumentDiagnosticAnalyzer and ProjectDiagnosticAnalyzer types, and this analyzer lies to us and returns 0 supported diagnostic descriptors: https://github.com/dotnet/roslyn/blob/315c2e149ba7889b0937d872274c33fcbfe9af5f/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptDocumentDiagnosticAnalyzer.cs#L16 and https://github.com/dotnet/roslyn/blob/315c2e149ba7889b0937d872274c33fcbfe9af5f/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptProjectDiagnosticAnalyzer.cs#L16. So, we skip TS analyzers for "Normal" priority bucket. This PR implements a short term fix to update the newly added code to special case DocumentDiagnosticAnalyzers and skip the newly added perf optimization for these analyzers. Note that ProjectDiagnosticAnalyzers are never executed in lightbulb/code fix path. I will create a separate issue to track designing a better long term solution for TS analyzers to avoid such breaking changes in future.
Contributor
Author
|
Tagging @vatsalyaagrawal @jinujoseph - do I need to target this PR to a specific release branch for next 17.1 preview OR targeting main branch will make it flow into next 17.1 preview? |
CyrusNajmabadi
approved these changes
Dec 17, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes AB#1450689
This regression was introduced with async lightbulb performance improvement PR: #56959. With that PR, we now optimize/reduce the number of analyzers to execute in the "Normal" priority bucket for async light bulb. We earlier executed all analyzers in this bucket, but now only try to execute analyzers which report at least one diagnostic ID which has a corresponding code fix provider that can fix that diagnostic ID.
To identify this reduced set of analyzers, we execute this newly added perf optimization to skip analyzers that don't have a code fix:
roslyn/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
Lines 151 to 155 in 88f8299
_owner.DiagnosticAnalyzerInfoCache.GetDiagnosticDescriptorscall in this code is problematic for TS analyzers, because these are not regular DiagnosticAnalyzer sub-types, but instead derive from our internal DocumentDiagnosticAnalyzer and ProjectDiagnosticAnalyzer types, and this analyzer lies to us and returns 0 supported diagnostic descriptors:roslyn/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptDocumentDiagnosticAnalyzer.cs
Line 16 in 315c2e1
roslyn/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptProjectDiagnosticAnalyzer.cs
Line 16 in 315c2e1
This PR implements a short term fix to update the newly added code to special case DocumentDiagnosticAnalyzers and skip the newly added perf optimization for these analyzers. Note that ProjectDiagnosticAnalyzers are never executed in lightbulb/code fix path.
I will create a separate issue to track designing a better long term solution for TS analyzers to avoid such breaking changes in future.