Ejemplo n.º 1
0
 public static void ReportFileError(
     GeneratorExecutionContext context,
     IError error,
     HotChocolate.Location location,
     string title,
     string code,
     string filePath)
 {
     context.ReportDiagnostic(
         Diagnostic.Create(
             new DiagnosticDescriptor(
                 id: code,
                 title: title,
                 messageFormat: error.Message,
                 category: _category,
                 DiagnosticSeverity.Error,
                 isEnabledByDefault: true),
             Microsoft.CodeAnalysis.Location.Create(
                 filePath,
                 TextSpan.FromBounds(
                     1,
                     2),
                 new LinePositionSpan(
                     new LinePosition(
                         location.Line,
                         location.Column),
                     new LinePosition(
                         location.Line,
                         location.Column + 1)))));
 }
 public static void ReportDiagnostic(
     this GeneratorExecutionContext context,
     string id,
     string title,
     string message,
     string filePath,
     HotChocolate.Location location) =>
 context.ReportDiagnostic(
     Diagnostic.Create(
         new DiagnosticDescriptor(
             id: id,
             title: title,
             messageFormat: message,
             category: DiagnosticErrorHelper.ErrorCategory,
             DiagnosticSeverity.Error,
             isEnabledByDefault: true),
         Microsoft.CodeAnalysis.Location.Create(
             filePath,
             TextSpan.FromBounds(1, 2),
             new LinePositionSpan(
                 new LinePosition(
                     location.Line,
                     location.Column),
                 new LinePosition(
                     location.Line,
                     location.Column + 1)))));
 public static void ReportDiagnostic(
     this GeneratorExecutionContext context,
     DiagnosticDescriptor descriptor,
     string filePath,
     HotChocolate.Location location,
     params object[] messageArgs) =>
 context.ReportDiagnostic(Diagnostic.Create(
                              descriptor,
                              Microsoft.CodeAnalysis.Location.Create(
                                  filePath,
                                  TextSpan.FromBounds(1, 2),
                                  new LinePositionSpan(
                                      new LinePosition(
                                          location.Line,
                                          location.Column),
                                      new LinePosition(
                                          location.Line,
                                          location.Column + 1))),
                              messageArgs));