Skip to content

Commit

Permalink
Merge pull request #74352 from CyrusNajmabadi/removeFlag
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi authored Jul 11, 2024
2 parents 0b25f92 + d30cac3 commit a7af126
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private class ThrowingDoNotCatchDiagnosticAnalyzer<TLanguageKindEnum> : Throwing
public bool IsHighPriority => false;

public DiagnosticAnalyzerCategory GetAnalyzerCategory()
=> DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis | DiagnosticAnalyzerCategory.SemanticDocumentAnalysis | DiagnosticAnalyzerCategory.ProjectAnalysis;
=> DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis | DiagnosticAnalyzerCategory.SemanticDocumentAnalysis;
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ internal static partial class DiagnosticAnalyzerExtensions
public static DiagnosticAnalyzerCategory GetDiagnosticAnalyzerCategory(this DiagnosticAnalyzer analyzer)
=> analyzer switch
{
FileContentLoadAnalyzer _ => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis,
DocumentDiagnosticAnalyzer _ => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis | DiagnosticAnalyzerCategory.SemanticDocumentAnalysis,
ProjectDiagnosticAnalyzer _ => DiagnosticAnalyzerCategory.ProjectAnalysis,
FileContentLoadAnalyzer => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis,
DocumentDiagnosticAnalyzer => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis | DiagnosticAnalyzerCategory.SemanticDocumentAnalysis,
ProjectDiagnosticAnalyzer => DiagnosticAnalyzerCategory.None,
IBuiltInAnalyzer builtInAnalyzer => builtInAnalyzer.GetAnalyzerCategory(),

// Compiler analyzer supports syntax diagnostics, span-based semantic diagnostics and project level diagnostics.
// For a public analyzer it is not possible to know the diagnostic categorization, so return a worst-case categorization.
_ => analyzer.IsCompilerAnalyzer()
? DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis | DiagnosticAnalyzerCategory.SemanticSpanAnalysis | DiagnosticAnalyzerCategory.ProjectAnalysis
: DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis | DiagnosticAnalyzerCategory.SemanticDocumentAnalysis | DiagnosticAnalyzerCategory.ProjectAnalysis
? DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis | DiagnosticAnalyzerCategory.SemanticSpanAnalysis
: DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis | DiagnosticAnalyzerCategory.SemanticDocumentAnalysis,
};

public static bool SupportAnalysisKind(this DiagnosticAnalyzer analyzer, AnalysisKind kind)
Expand Down Expand Up @@ -48,10 +48,4 @@ public static bool SupportsSpanBasedSemanticDiagnosticAnalysis(this DiagnosticAn
var category = analyzer.GetDiagnosticAnalyzerCategory();
return (category & DiagnosticAnalyzerCategory.SemanticSpanAnalysis) != 0;
}

public static bool SupportsProjectDiagnosticAnalysis(this DiagnosticAnalyzer analyzer)
{
var category = analyzer.GetDiagnosticAnalyzerCategory();
return (category & DiagnosticAnalyzerCategory.ProjectAnalysis) != 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,4 @@ internal enum DiagnosticAnalyzerCategory
/// It needs to re-analyze the whole document for reporting semantic diagnostics even for method body editing scenarios.
/// </summary>
SemanticDocumentAnalysis = 0x0100,

/// <summary>
/// Analyzer reports project diagnostics (i.e. registers a Compilation action and/or Compilation end action diagnostics).
/// </summary>
ProjectAnalysis = 0x1000
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.CodeAnalysis.Simplification;

namespace Microsoft.CodeAnalysis.Diagnostics;

/// <summary>
Expand Down

0 comments on commit a7af126

Please sign in to comment.