-
Notifications
You must be signed in to change notification settings - Fork 14
/
AnonymousObjectWithoutDestructuringWarning.cs
61 lines (49 loc) · 1.76 KB
/
AnonymousObjectWithoutDestructuringWarning.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
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.Util;
using ReSharper.Structured.Logging.Highlighting;
using ReSharper.Structured.Logging.Serilog.Parsing;
[assembly:
RegisterConfigurableSeverity(
AnonymousObjectDestructuringWarning.SeverityId,
null,
HighlightingGroupIds.CompilerWarnings,
AnonymousObjectDestructuringWarning.Message,
AnonymousObjectDestructuringWarning.Message,
Severity.WARNING)]
namespace ReSharper.Structured.Logging.Highlighting
{
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class AnonymousObjectDestructuringWarning : IHighlighting
{
public const string Message = "Anonymous objects must be destructured";
public const string SeverityId = "AnonymousObjectDestructuringProblem";
public AnonymousObjectDestructuringWarning(
IStringLiteralAlterer stringLiteral,
PropertyToken namedProperty,
DocumentRange documentRange)
{
StringLiteral = stringLiteral;
NamedProperty = namedProperty;
Range = documentRange;
}
public string ErrorStripeToolTip => ToolTip;
public PropertyToken NamedProperty { get; }
public DocumentRange Range { get; }
public IStringLiteralAlterer StringLiteral { get; }
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return Range;
}
public bool IsValid()
{
return Range.IsValid();
}
}
}