Show linked symbol in Inheritance Margin#60225
Conversation
|
@CyrusNajmabadi |
src/Features/Core/Portable/InheritanceMargin/Finders/DerivedTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/BaseTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
...tures/Core/Portable/InheritanceMargin/Finders/ImplementedSymbolAndOverriddenSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/ImplementingSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/InheritanceSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
|
@CyrusNajmabadi PTAL : ) |
357b6ef to
18f7fca
Compare
src/Features/Core/Portable/InheritanceMargin/Finders/BaseTypeSymbolsFinder.cs
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/BaseTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/BaseTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/BaseTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/BaseTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/BaseTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/DerivedTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/DerivedTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/DerivedTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/InheritanceMargin/Finders/DerivedTypeSymbolsFinder.cs
Outdated
Show resolved
Hide resolved
|
Done with pass. |
|
Tag @CyrusNajmabadi to revisit this : ) |
| // And since interface can't have base class, the item before a baseClass is just the previous item in the array. | ||
| // e.g. 'baseClass2' could only be pointed by 'baseClass1'. | ||
| var baseType = baseTypes[i]; | ||
| var incomingSymbolsSetForBaseType = s_symbolHashSetPool.Allocate(); |
There was a problem hiding this comment.
All Hashset usage of s_symbolHashSetPool.Allocate() is disposed in the using var _ = GetPooledHashSetDictionary(out var incomingSymbolsMapBuilder); (See SymbolSetDictionaryDisposer below)
If this pattern is not easy to understand I am also fine to use the traddtional try-finally block to free the PooledDicionary and the PooledHashSet in it
| TestHostDocument testHostDocument, | ||
| TestInheritanceMemberItem[] memberItems, | ||
| CancellationToken cancellationToken) | ||
| CancellationToken cancellationToken = default) |
There was a problem hiding this comment.
odd that we even have this parameter at all :)
| if (baseInterfaceSymbolGroups.Any() || derivedTypeSymbolGroups.Any()) | ||
| { | ||
| // Interface can only have base interfaces. | ||
| Debug.Assert(baseTypeSymbolGroups.IsEmpty); |
There was a problem hiding this comment.
this assert is ok. but it can be worrying as perhaps teh compiler might have other symbols in error conditions. but fine to keep for now as it's only a debug assert.
| ImmutableArray<ISymbol> derivedTypesSymbols, | ||
| ImmutableArray<SymbolGroup> baseSymbolGroups, | ||
| ImmutableArray<SymbolGroup> derivedTypesSymbolGroups, | ||
| CancellationToken cancellationToken) |
There was a problem hiding this comment.
aside, this member returns an Item?. is null actually possible to return here?
There was a problem hiding this comment.
| var location = locations[0]; | ||
| return location.IsInMetadata || (location.IsInSource && location.IsVisibleSourceLocation()); | ||
| } | ||
| return !locations.IsEmpty; |
There was a problem hiding this comment.
not sure i get the logic here. it's navigable if it's either got one location that hav esome property, or it has 2 or more locations total?
|
|
||
| private static ImmutableArray<ISymbol> GetImplementedSymbolsForTypeMember( | ||
| ISymbol memberSymbol, | ||
| ImmutableArray<ISymbol> overriddenSymbols) |
There was a problem hiding this comment.
what happened with this guy? :)
There was a problem hiding this comment.
I think it has been replaced by ImplementedSymbolAndOverriddenSymbolsFinder
Inheritance margin now only shows the inheritance hierarchy within the current document.


For example:
If I open https://github.com/dotnet/roslyn/blob/main/src/EditorFeatures/Core/Tagging/AsynchronousViewTaggerProvider.cs
If I am in netcoreapp3.1
If I am in netstandard2.0
Note InheritanceMarginTaggerProvideris not shown in netcoreapp3.1.
This is because it is in LanguageServices project, and this project is only targeting net472, which is referencing the netstandard 2.0 version of AsynchronousViewTaggerProvider.
This behavior, is different from the 'Go To Implementation' command, which will show all the linked implementation symbols.
And this PR changes the inheritance margin's behavior to match what 'Go To Implementation' command does.