Skip to content

Commit

Permalink
Merge pull request #73339 from js6pak/use-diagnostichelper-for-options
Browse files Browse the repository at this point in the history
Always use DiagnosticHelper.Create for diagnostics with options
  • Loading branch information
sharwell authored May 31, 2024
2 parents 5d852d4 + fa907c7 commit 12a14f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ private void AnalyzeNamespaceNode(SyntaxNodeAnalysisContext context)
var nameSyntax = GetSyntaxFacts().GetNameOfBaseNamespaceDeclaration(namespaceDecl);
RoslynDebug.AssertNotNull(nameSyntax);

context.ReportDiagnostic(Diagnostic.Create(
context.ReportDiagnostic(DiagnosticHelper.Create(
Descriptor,
nameSyntax.GetLocation(),
option.Notification,
context.Options,
additionalLocations: null,
properties: ImmutableDictionary<string, string?>.Empty.Add(MatchFolderAndNamespaceConstants.TargetNamespace, targetNamespace),
messageArgs: new[] { currentNamespace, targetNamespace }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ protected void CheckModifiers(
// If the severity is hidden, put the marker on all the modifiers so that the
// user can bring up the fix anywhere in the modifier list.
context.ReportDiagnostic(
Diagnostic.Create(Descriptor, context.Tree.GetLocation(
TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End))));
DiagnosticHelper.Create(
Descriptor,
context.Tree.GetLocation(TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End)),
notificationOption,
context.Options,
additionalLocations: null,
properties: null));
}
else
{
Expand Down

0 comments on commit 12a14f8

Please sign in to comment.