fix looking up references of class with a primary ctor

This commit is contained in:
Matt Parker
2025-10-27 19:18:08 +10:00
parent 5dde9bfad6
commit 39d777a8c3

View File

@@ -31,6 +31,9 @@ public partial class SharpIdeCodeEdit
GD.Print($"Symbol is declared here: {symbolString}");
// TODO: Lookup references instead
var references = await _roslynAnalysis.FindAllSymbolReferences(semanticInfo.Value.DeclaredSymbol);
// Filter out primary constructor references, as they are not useful to navigate to - we are already at the symbol declaration
// This may also filter out other useful references, so may need to revisit later
references = references.Where(s => s.LocationsArray.Length is not 0).ToImmutableArray();
if (references.Length is 1)
{
var reference = references[0];