@@ -84,19 +84,18 @@ SymbolType.Class or
84
84
}
85
85
86
86
/// <summary>
87
- /// Take a codelens and create a new codelens object with updated references.
87
+ /// Take a CodeLens and create a new CodeLens object with updated references.
88
88
/// </summary>
89
89
/// <param name="codeLens">The old code lens to get updated references for.</param>
90
90
/// <param name="scriptFile"></param>
91
91
/// <param name="cancellationToken"></param>
92
- /// <returns>A new code lens object describing the same data as the old one but with updated references.</returns>
92
+ /// <returns>A new CodeLens object describing the same data as the old one but with updated references.</returns>
93
93
public async Task < CodeLens > ResolveCodeLens (
94
94
CodeLens codeLens ,
95
95
ScriptFile scriptFile ,
96
96
CancellationToken cancellationToken )
97
97
{
98
- ScriptFile [ ] references = _workspaceService . ExpandScriptReferences (
99
- scriptFile ) ;
98
+ ScriptFile [ ] references = _workspaceService . ExpandScriptReferences ( scriptFile ) ;
100
99
101
100
SymbolReference foundSymbol = SymbolsService . FindSymbolDefinitionAtLocation (
102
101
scriptFile ,
@@ -123,7 +122,8 @@ await _symbolsService.ScanForReferencesOfSymbol(
123
122
// so it's helpful to add some yields.
124
123
await Task . Yield ( ) ;
125
124
cancellationToken . ThrowIfCancellationRequested ( ) ;
126
- if ( IsReferenceDefinition ( foundSymbol , foundReference ) )
125
+
126
+ if ( foundReference . IsDeclaration )
127
127
{
128
128
continue ;
129
129
}
@@ -165,27 +165,6 @@ await _symbolsService.ScanForReferencesOfSymbol(
165
165
} ;
166
166
}
167
167
168
- /// <summary>
169
- /// Check whether a SymbolReference is the actual definition of that symbol.
170
- /// </summary>
171
- /// <param name="definition">The symbol definition that may be referenced.</param>
172
- /// <param name="reference">The reference symbol to check.</param>
173
- /// <returns>True if the reference is not a reference to the definition, false otherwise.</returns>
174
- private static bool IsReferenceDefinition (
175
- SymbolReference definition ,
176
- SymbolReference reference )
177
- {
178
- // First check if we are in the same file as the definition. if we are...
179
- // check if it's on the same line number.
180
-
181
- // TODO: Do we care about two symbol definitions of the same name?
182
- // if we do, how could we possibly know that a reference in one file is a reference
183
- // of a particular symbol definition?
184
- return
185
- definition . FilePath == reference . FilePath &&
186
- definition . ScriptRegion . StartLineNumber == reference . ScriptRegion . StartLineNumber ;
187
- }
188
-
189
168
/// <summary>
190
169
/// Get the code lens header for the number of references on a definition,
191
170
/// given the number of references.
0 commit comments