Skip to content

Make more APIs project-based in diag service.#77122

Merged
CyrusNajmabadi merged 13 commits intodotnet:mainfrom
CyrusNajmabadi:projectDiagBased
Feb 10, 2025
Merged

Make more APIs project-based in diag service.#77122
CyrusNajmabadi merged 13 commits intodotnet:mainfrom
CyrusNajmabadi:projectDiagBased

Conversation

@CyrusNajmabadi
Copy link
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Feb 8, 2025

Followup to #77121

Also address feedback from #77121

@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 8, 2025
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review February 10, 2025 20:13
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner February 10, 2025 20:13

await analyzerService.GetDiagnosticsForIdsAsync(
sourceDocument.Project.Solution, sourceDocument.Project.Id, sourceDocument.Id, diagnosticIds: null, shouldIncludeAnalyzer: null,
sourceDocument.Project, sourceDocument.Id, diagnosticIds: null, shouldIncludeAnalyzer: null,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

most callers had a project, but would then use it to pass a Solution+ProjectId. Simpler to just pass Project

return list.ToImmutableAndClear();
}

private static async Task<ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<DiagnosticData>>> ComputeDocumentDiagnosticsCoreAsync(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are moves of a couple of static methods to an outer scope so they can be seen by a few nested types.

@CyrusNajmabadi
Copy link
Contributor Author

@ToddGrun @dibarbet this is ready for review.

var exceptionFilter = (Exception ex) =>
{
return ex =>
if (ex is not OperationCanceledException && crashOnAnalyzerException)
Copy link
Contributor

Choose a reason for hiding this comment

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

crashOnAnalyzerException

this is the bit that's preventing this from being a static local function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will check.

else
{
var analyzerWithStateAndEmptyData = analyzer;
if (!compilerAnalyzerData.HasValue && analyzer.IsCompilerAnalyzer())
Copy link
Contributor

Choose a reason for hiding this comment

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

if (!compilerAnalyzerData.HasValue && analyzer.IsCompilerAnalyzer())

Could the loop contents just be:

var spanBased = (oldDocumentVersion == VersionStamp.Default);
if (!compilerAnalyzerData.HasValue && analyzer.IsCompilerAnalyzer())
  compilerAnalyzerData = (analyzer, spanBased);
else if (spanBased)
  spanBasedAnalyzers.Add(analyzer);
else
  documentBasedAnalyzers.Add(analyzer);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will check.

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 d397200 into dotnet:main Feb 10, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE 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.

4 participants