forked from codecadwallader/codemaid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseCodeItem.cs
More file actions
85 lines (70 loc) · 2.38 KB
/
BaseCodeItem.cs
File metadata and controls
85 lines (70 loc) · 2.38 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using EnvDTE;
using SteveCadwallader.CodeMaid.UI;
using System.Diagnostics;
namespace SteveCadwallader.CodeMaid.Model.CodeItems
{
/// <summary>
/// A base class representation of all code items. Includes VSX supported CodeElements as well
/// as code regions.
/// </summary>
[DebuggerDisplay("{GetType().Name,nq}: {Name}")]
public abstract class BaseCodeItem : Bindable, ICodeItem
{
#region Properties
/// <summary>
/// Gets the kind.
/// </summary>
public abstract KindCodeItem Kind { get; }
/// <summary>
/// Gets or sets the name, may be empty.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets the start line.
/// </summary>
public int StartLine { get; set; }
/// <summary>
/// Gets or sets the start offset.
/// </summary>
public int StartOffset { get; set; }
/// <summary>
/// Gets or sets the start point, may be null.
/// </summary>
public virtual EditPoint StartPoint { get; set; }
/// <summary>
/// Gets or sets the end line.
/// </summary>
public int EndLine { get; set; }
/// <summary>
/// Gets or sets the end offset.
/// </summary>
public int EndOffset { get; set; }
/// <summary>
/// Gets or sets the end point, may be null.
/// </summary>
public virtual EditPoint EndPoint { get; set; }
/// <summary>
/// Gets a flag indicating if this is a code item that spans multiple lines.
/// </summary>
public bool IsMultiLine => StartPoint != null && EndPoint != null && StartPoint.Line != EndPoint.Line;
#endregion Properties
#region Methods
/// <summary>
/// Loads all lazy initialized values immediately.
/// </summary>
public virtual void LoadLazyInitializedValues()
{
}
/// <summary>
/// Refreshes the cached position and name fields on this item.
/// </summary>
public virtual void RefreshCachedPositionAndName()
{
StartLine = StartPoint.Line;
StartOffset = StartPoint.AbsoluteCharOffset;
EndLine = EndPoint.Line;
EndOffset = EndPoint.AbsoluteCharOffset;
}
#endregion Methods
}
}