1
1
// Copyright (c) Microsoft Corporation.
2
2
// Licensed under the MIT License.
3
3
4
+ #nullable enable
5
+
4
6
using System . Diagnostics ;
5
7
using System . Management . Automation . Language ;
6
8
using Microsoft . PowerShell . EditorServices . Services . TextDocument ;
7
9
8
10
namespace Microsoft . PowerShell . EditorServices . Services . Symbols
9
11
{
10
- internal interface ISymbolReference
11
- {
12
- /// <summary>
13
- /// Gets the symbol's type
14
- /// </summary>
15
- SymbolType SymbolType { get ; }
16
-
17
- /// <summary>
18
- /// Gets the name of the symbol
19
- /// </summary>
20
- string SymbolName { get ; }
21
-
22
- /// <summary>
23
- /// Gets the script extent of the symbol
24
- /// </summary>
25
- ScriptRegion ScriptRegion { get ; }
26
-
27
- /// <summary>
28
- /// Gets the contents of the line the given symbol is on
29
- /// </summary>
30
- string SourceLine { get ; }
31
-
32
- /// <summary>
33
- /// Gets the path of the file in which the symbol was found.
34
- /// </summary>
35
- string FilePath { get ; }
36
- }
37
-
38
12
/// <summary>
39
13
/// A class that holds the type, name, script extent, and source line of a symbol
40
14
/// </summary>
41
15
[ DebuggerDisplay ( "SymbolType = {SymbolType}, SymbolName = {SymbolName}" ) ]
42
- internal class SymbolReference : ISymbolReference
16
+ internal record SymbolReference
43
17
{
44
- #region Properties
45
-
46
- /// <summary>
47
- /// Gets the symbol's type
48
- /// </summary>
49
18
public SymbolType SymbolType { get ; }
50
19
51
- /// <summary>
52
- /// Gets the name of the symbol
53
- /// </summary>
54
20
public string SymbolName { get ; }
55
21
56
- /// <summary>
57
- /// Gets the script extent of the symbol
58
- /// </summary>
59
22
public ScriptRegion ScriptRegion { get ; }
60
23
61
- /// <summary>
62
- /// Gets the contents of the line the given symbol is on
63
- /// </summary>
64
24
public string SourceLine { get ; internal set ; }
65
25
66
- /// <summary>
67
- /// Gets the path of the file in which the symbol was found.
68
- /// </summary>
69
26
public string FilePath { get ; internal set ; }
70
27
71
- #endregion
72
-
73
28
/// <summary>
74
29
/// Constructs and instance of a SymbolReference
75
30
/// </summary>
@@ -88,16 +43,9 @@ public SymbolReference(
88
43
// TODO: Verify params
89
44
SymbolType = symbolType ;
90
45
SymbolName = symbolName ;
91
- ScriptRegion = ScriptRegion . Create ( scriptExtent ) ;
46
+ ScriptRegion = new ( scriptExtent ) ;
92
47
FilePath = filePath ;
93
48
SourceLine = sourceLine ;
94
-
95
- // TODO: Make sure end column number usage is correct
96
-
97
- // Build the display string
98
- //this.DisplayString =
99
- // string.Format(
100
- // "{0} {1}")
101
49
}
102
50
103
51
public SymbolReference (
@@ -108,7 +56,7 @@ public SymbolReference(
108
56
{
109
57
SymbolType = symbolType ;
110
58
SymbolName = symbolName ;
111
- ScriptRegion = ScriptRegion . Create ( scriptExtent ) ;
59
+ ScriptRegion = new ( scriptExtent ) ;
112
60
FilePath = file . FilePath ;
113
61
try
114
62
{
0 commit comments