-
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
Make more APIs project-based in diag service. #77122
Conversation
@@ -1075,7 +1075,7 @@ await VerifyCachedDiagnosticsAsync( | |||
: root.DescendantNodes().OfType<CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax>().First().Span; | |||
|
|||
await analyzerService.GetDiagnosticsForIdsAsync( | |||
sourceDocument.Project.Solution, sourceDocument.Project.Id, sourceDocument.Id, diagnosticIds: null, shouldIncludeAnalyzer: null, | |||
sourceDocument.Project, sourceDocument.Id, diagnosticIds: null, shouldIncludeAnalyzer: null, |
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.
most callers had a project, but would then use it to pass a Solution+ProjectId. Simpler to just pass Project
@@ -43,6 +43,31 @@ public async Task<ImmutableArray<DiagnosticData>> GetDiagnosticsForSpanAsync( | |||
return list.ToImmutableAndClear(); | |||
} | |||
|
|||
private static async Task<ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<DiagnosticData>>> ComputeDocumentDiagnosticsCoreAsync( |
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.
these are moves of a couple of static methods to an outer scope so they can be seen by a few nested types.
{ | ||
return ex => | ||
if (ex is not OperationCanceledException && crashOnAnalyzerException) |
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.
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.
will check.
@@ -94,18 +92,17 @@ public async Task<ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnos | |||
} | |||
else | |||
{ | |||
var analyzerWithStateAndEmptyData = analyzer; | |||
if (!compilerAnalyzerData.HasValue && analyzer.IsCompilerAnalyzer()) |
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.
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);
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.
will check.
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.
Followup to #77121
Also address feedback from #77121