Class ParserDiagnostic
- Namespace
- Utils.Parser.Diagnostics
- Assembly
- Utils.Parser.Diagnostics.dll
Represents one emitted diagnostic message instance.
public sealed class ParserDiagnostic
- Inheritance
-
ParserDiagnostic
- Inherited Members
- Extension Methods
Constructors
ParserDiagnostic(DiagnosticDetails, DiagnosticSpan?, SourceCodeLocation?)
Initializes a new diagnostic instance.
public ParserDiagnostic(DiagnosticDetails details, DiagnosticSpan? span = null, SourceCodeLocation? location = null)
Parameters
detailsDiagnosticDetailsDiagnostic details.
spanDiagnosticSpanOptional source span.
locationSourceCodeLocationOptional source location.
ParserDiagnostic(ParserDiagnosticDescriptor, string, int?, int?, string?, Exception?)
Initializes a new diagnostic instance.
public ParserDiagnostic(ParserDiagnosticDescriptor descriptor, string message, int? spanStart = null, int? spanLength = null, string? ruleName = null, Exception? exception = null)
Parameters
descriptorParserDiagnosticDescriptorDiagnostic descriptor.
messagestringResolved diagnostic message.
spanStartint?Optional source span start position.
spanLengthint?Optional source span length.
ruleNamestringOptional rule name context.
exceptionExceptionOptional related exception.
Properties
Code
Gets the diagnostic code.
public string Code { get; }
Property Value
Descriptor
Gets the descriptor.
public ParserDiagnosticDescriptor Descriptor { get; }
Property Value
Details
Gets the descriptor.
public DiagnosticDetails Details { get; }
Property Value
Exception
Gets the optional related exception.
public Exception? Exception { get; }
Property Value
Location
Gets the optional human-readable source location.
public SourceCodeLocation? Location { get; }
Property Value
Message
Gets the resolved message.
public string Message { get; }
Property Value
RuleName
Gets the optional rule name context.
public string? RuleName { get; }
Property Value
Severity
Gets the diagnostic severity.
public DiagnosticSeverity Severity { get; }
Property Value
Span
Gets the optional source span.
public DiagnosticSpan? Span { get; }
Property Value
Methods
ToDisplayString()
Formats the diagnostic in file/line/column style.
public string ToDisplayString()