Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 27, 2025 19:27
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 27, 2025
public static bool IsWorkspaceDiagnosticAnalyzer(this DiagnosticAnalyzer analyzer)
=> analyzer is DocumentDiagnosticAnalyzer
|| analyzer is ProjectDiagnosticAnalyzer
|| analyzer == FileContentLoadAnalyzer.Instance
Copy link
Member Author

Choose a reason for hiding this comment

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

FileContentLoadAnalyzer is just a DocumentDiagnosticAnalyzer now. so we don't need this special check.

var document = textDocument as Document;
RoslynDebug.Assert(document != null || kind == AnalysisKind.Syntax, "We only support syntactic analysis for non-source documents");

var loadDiagnostic = await textDocument.State.GetLoadDiagnosticAsync(cancellationToken).ConfigureAwait(false);
Copy link
Member Author

Choose a reason for hiding this comment

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

computation and returning of this diagnostic is pushed into FileContentLoadAnalyzer itself, instead of having to special case it here.

foreach (var document in project.Documents)
{
// don't analyze documents whose content failed to load
if (failedDocuments == null || !failedDocuments.Contains(document))
Copy link
Member Author

Choose a reason for hiding this comment

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

we don't need to track of the content failed to load. if it failed to load, it's just an empty string, which doesn't report diagnostics anyways.


private sealed class HostAnalyzerInfo
{
private const int FileContentLoadAnalyzerPriority = -4;
Copy link
Member Author

Choose a reason for hiding this comment

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

moved into the FileContentloadAnalyzer.

FileContentLoadAnalyzer _ => FileContentLoadAnalyzerPriority,
GeneratorDiagnosticsPlaceholderAnalyzer _ => GeneratorDiagnosticsPlaceholderAnalyzerPriority,
DocumentDiagnosticAnalyzer analyzer => Math.Max(0, analyzer.Priority),
DocumentDiagnosticAnalyzer analyzer => analyzer.Priority,
Copy link
Member Author

Choose a reason for hiding this comment

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

removed as we do just want to pass the priority through. Note that FileContentLoad is still pri -4, and the rest of the doc analyzers (which we own 100%) are all just at 50 and never change.

@CyrusNajmabadi
Copy link
Member Author

@JoeRobich ptal.

@CyrusNajmabadi CyrusNajmabadi merged commit 1f81109 into dotnet:release/dev17.15 Mar 28, 2025
25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the fileLoadAnalyzer branch March 28, 2025 02:05
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.

2 participants