diff --git a/src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs b/src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs
index c8dfc72d8..68c36aa1f 100644
--- a/src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs
+++ b/src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs
@@ -139,7 +139,7 @@ public CodeLens ResolveCodeLens(CodeLens codeLens, ScriptFile scriptFile)
}
///
- /// Check whether a SymbolReference is not a reference to another defined symbol.
+ /// Check whether a SymbolReference is the actual definition of that symbol.
///
/// The symbol definition that may be referenced.
/// The reference symbol to check.
@@ -148,11 +148,15 @@ private static bool IsReferenceDefinition(
SymbolReference definition,
SymbolReference reference)
{
+ // First check if we are in the same file as the definition. if we are...
+ // check if it's on the same line number.
+
+ // TODO: Do we care about two symbol definitions of the same name?
+ // if we do, how could we possibly know that a reference in one file is a reference
+ // of a particular symbol definition?
return
- definition.FilePath != reference.FilePath
- || definition.ScriptRegion.StartLineNumber != reference.ScriptRegion.StartLineNumber
- || definition.SymbolType != reference.SymbolType
- || !string.Equals(definition.SymbolName, reference.SymbolName, StringComparison.OrdinalIgnoreCase);
+ definition.FilePath == reference.FilePath &&
+ definition.ScriptRegion.StartLineNumber == reference.ScriptRegion.StartLineNumber;
}
///