Skip to content
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 nested types in diagnostic analyzer service #77124

Merged
merged 9 commits into from
Feb 11, 2025

Conversation

CyrusNajmabadi
Copy link
Member

Followup to #77122

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner February 9, 2025 19:48
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 9, 2025
@CyrusNajmabadi CyrusNajmabadi marked this pull request as draft February 9, 2025 20:01
@@ -31,12 +31,10 @@ internal interface IDiagnosticAnalyzerService
/// <summary>
/// Get diagnostics of the given diagnostic ids and/or analyzers from the given solution. all diagnostics returned
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the given solution

needs updating?

@CyrusNajmabadi CyrusNajmabadi changed the title remove nested types in diagnostic analyzer service Remove nested types in diagnostic analyzer service Feb 10, 2025
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review February 10, 2025 23:54
@CyrusNajmabadi
Copy link
Member Author

@ToddGrun thia is ready for review.

bool includeLocalDocumentDiagnostics,
bool includeNonLocalDocumentDiagnostics)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

general idea is that instead of making tehse nested types, which have to grab all this data, just to store fields, just to use in methods within the type, we just use local functions.

@@ -22,7 +22,7 @@ private partial class DiagnosticIncrementalAnalyzer
/// <summary>
/// Cached data from a real <see cref="Project"/> instance to the cached diagnostic data produced by
/// <em>all</em> the analyzers for the project. This data can then be used by <see
/// cref="DiagnosticGetter.ProduceDiagnosticsAsync"/> to speed up subsequent calls through the normal <see
/// cref="GetDiagnosticsForIdsAsync"/> to speed up subsequent calls through the normal <see
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetDiagnosticsForIdsAsync

Should we consider making these new CWTs static to avoid any possibility of the issue that's been my bane today?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do!

public async Task GetAsync(ArrayBuilder<DiagnosticData> list, CancellationToken cancellationToken)
return list.ToImmutableAndClear();

async Task GetAsync(ArrayBuilder<DiagnosticData> list)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetAsync

This name is a bit lacking

@ToddGrun
Copy link
Contributor

FYI, I really like this change. These *Getter classes for some reason added a lot of conceptual weight to this area for me.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@CyrusNajmabadi CyrusNajmabadi merged commit 700edd9 into dotnet:main Feb 11, 2025
25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the localFunctionDiags branch February 11, 2025 06:54
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants