-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove 'state set' concept for diagnostic analysis subsystem. #77121
Conversation
...guageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs
Outdated
Show resolved
Hide resolved
…nosticIncrementalAnalyzer.Executor.cs
…slyn into removeStateSet
|
||
private sealed class HostAnalyzerStateSets | ||
private sealed class HostAnalyzerInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view with whitespace off. this moved up one level of nesting so other callers could talk directly to this.
// return existing state sets | ||
// No need to use _projectAnalyzerStateMapGuard during reads of _projectAnalyzerStateMap | ||
return _projectAnalyzerStateMap.Values.SelectManyAsArray(e => e.StateSetMap.Values); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never called.
@dibarbet ptal |
@dibarbet @JoeRobich This is ready for review. |
@ToddGrun ptal |
@@ -59,8 +61,8 @@ internal partial class DiagnosticAnalyzerService | |||
// </summary> | |||
async Task<CompilationWithAnalyzersPair?> CreateCompilationWithAnalyzersAsync() | |||
{ | |||
var projectAnalyzers = stateSets.SelectAsArray(s => !s.IsHostAnalyzer, s => s.Analyzer); | |||
var hostAnalyzers = stateSets.SelectAsArray(s => s.IsHostAnalyzer, s => s.Analyzer); | |||
var projectAnalyzers = analyzers.WhereAsArray(static (s, info) => !info.IsHostAnalyzer(s), hostAnalyzerInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var projectAnalyzers = analyzers.WhereAsArray(static (s, info) => !info.IsHostAnalyzer(s), hostAnalyzerInfo);
mentioned this after one of the earlier PRs had already been merged, but the projectAnalyzers/hostAnalyzers arrays appear to be intermediary arrays used only once, and the WhereAsArray conditions to create the filtered versions could be slightly modified to not need the intermediary arrays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup. can likely go through improve more here.
src/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs
Show resolved
Hide resolved
...rotocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs
Show resolved
Hide resolved
...Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs
Show resolved
Hide resolved
/// Creates a new project state sets. | ||
/// </summary> | ||
private ProjectAnalyzerStateSets CreateProjectStateSets(Project project) | ||
private ProjectAnalyzerInfo CreateProjectAnalyzerInfo(Project project) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - maybe male a local function inside UpdateProjectAnalyzerInfoAsync
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup. i have a followup that changes a lot of these cases to local functions.
Followup to #77113
This was just a class wrapping a DiagnosticAnalyzer and a bool saying if it was a host-analyzer or not. It's just much simpler and cleaner to pass around DiagnosticAnalyzers and occasionally call to a separate helper to determine if it is a host analyzer or not.