From d13eb7d2d5a83502fc83d8a11e045c8e994bdd46 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 7 Sep 2019 12:16:53 +0200 Subject: [PATCH] Support for getting severity from single diagnostic --- PorygonSharp/DiagnosticHandling/DiagnosticItem.cs | 12 +++++++++++- .../DiagnosticHandling/DiagnosticSeverity.cs | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 PorygonSharp/DiagnosticHandling/DiagnosticSeverity.cs diff --git a/PorygonSharp/DiagnosticHandling/DiagnosticItem.cs b/PorygonSharp/DiagnosticHandling/DiagnosticItem.cs index 8c1fb24..844ebe3 100644 --- a/PorygonSharp/DiagnosticHandling/DiagnosticItem.cs +++ b/PorygonSharp/DiagnosticHandling/DiagnosticItem.cs @@ -8,7 +8,7 @@ namespace PorygonSharp.DiagnosticHandling [StructLayout(LayoutKind.Sequential)] public struct InternalRepresentation { - private readonly int _severity; + private readonly DiagnosticSeverity _severity; private readonly DiagnosticCode _code; private readonly uint _start; private readonly uint _length; @@ -17,6 +17,11 @@ namespace PorygonSharp.DiagnosticHandling { return _code; } + + public DiagnosticSeverity GetSeverity() + { + return _severity; + } } private InternalRepresentation _internalRepresentation; @@ -51,5 +56,10 @@ namespace PorygonSharp.DiagnosticHandling { return Internal.GetCode(); } + + public DiagnosticSeverity GetSeverity() + { + return Internal.GetSeverity(); + } } } \ No newline at end of file diff --git a/PorygonSharp/DiagnosticHandling/DiagnosticSeverity.cs b/PorygonSharp/DiagnosticHandling/DiagnosticSeverity.cs new file mode 100644 index 0000000..cbde665 --- /dev/null +++ b/PorygonSharp/DiagnosticHandling/DiagnosticSeverity.cs @@ -0,0 +1,9 @@ +namespace PorygonSharp.DiagnosticHandling +{ + public enum DiagnosticSeverity + { + Info, + Warning, + Error + } +} \ No newline at end of file