/
NotificationOption.cs
65 lines (50 loc) · 2.36 KB
/
NotificationOption.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using Microsoft.CodeAnalysis.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeStyle
{
/// <inheritdoc cref="NotificationOption2"/>
public sealed class NotificationOption
{
private readonly NotificationOption2 _notificationOptionImpl;
/// <summary>
/// Name for the notification option.
/// </summary>
public string Name
{
get => Severity.GetDisplayString();
[Obsolete("Modifying a NotificationOption is not supported.", error: true)]
set => throw new InvalidOperationException();
}
/// <inheritdoc cref="NotificationOption2.Severity"/>
public ReportDiagnostic Severity
{
get => _notificationOptionImpl.Severity;
[Obsolete("Modifying a NotificationOption is not supported.", error: true)]
set => throw new InvalidOperationException();
}
[Obsolete("Use " + nameof(Severity) + " instead.")]
public DiagnosticSeverity Value
{
get => Severity.ToDiagnosticSeverity() ?? DiagnosticSeverity.Hidden;
set => throw new InvalidOperationException();
}
/// <inheritdoc cref="NotificationOption2.None"/>
public static readonly NotificationOption None = new(NotificationOption2.None);
/// <inheritdoc cref="NotificationOption2.Silent"/>
public static readonly NotificationOption Silent = new(NotificationOption2.Silent);
/// <inheritdoc cref="NotificationOption2.Suggestion"/>
public static readonly NotificationOption Suggestion = new(NotificationOption2.Suggestion);
/// <inheritdoc cref="NotificationOption2.Warning"/>
public static readonly NotificationOption Warning = new(NotificationOption2.Warning);
/// <inheritdoc cref="NotificationOption2.Error"/>
public static readonly NotificationOption Error = new(NotificationOption2.Error);
private NotificationOption(NotificationOption2 notificationOptionImpl)
=> _notificationOptionImpl = notificationOptionImpl;
public override string ToString() => Name;
}
}