Add inheritance margin service and tagger#51929
Add inheritance margin service and tagger#51929Cosifne merged 35 commits intodotnet:feature/inheritanceMarginfrom
Conversation
src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/InheritanceMarginOptions.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/InheritanceMarginOptions.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/InheritanceTargetItem.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/InheritanceTargetItem.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core.Wpf/InheritanceMargin/InheritanceMarginTag.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
| /// <summary> | ||
| /// For the <param name="memberSymbol"/>, get all the symbols implementing it. | ||
| /// </summary> | ||
| private static async Task<ImmutableArray<ISymbol>> GetImplementedSymbolsAsync( |
There was a problem hiding this comment.
| private static async Task<ImmutableArray<ISymbol>> GetImplementedSymbolsAsync( | |
| private static async Task<ImmutableArray<ISymbol>> GetImplementingSymbolsAsync( |
There was a problem hiding this comment.
: ) It should be implemented, since the 'implemented' is the down arrow. I'll update the comments here
There was a problem hiding this comment.
I↓ indicates that the current symbol (memberSymbol) is implemented by one or more other symbols. Those other symbols are the implementing symbols of memberSymbol.
There was a problem hiding this comment.
I'll try to send a small PR tomorrow to make all the cases consistent throughout this PR. Will be easier than itemizing them all in review.
There was a problem hiding this comment.
I think I found the gap, KnowMoniker.Implemented is I↓ and I basically follow its definition. And I think you treat is in the opsite way.
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService_Helpers.cs
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
| // 2. System.ValueType. (otherwise margin would be shown for all structs) | ||
| // 3. System.Enum. (otherwise margin would be shown for all enum) | ||
| var baseTypes = allBaseTypes | ||
| .WhereAsArray(symbol => !IsUnwantedBaseType((ITypeSymbol)symbol)); |
There was a problem hiding this comment.
the cast here seems unnecessary.
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService_Helpers.cs
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService_Helpers.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService_Helpers.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService_Helpers.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService_Helpers.cs
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService_Helpers.cs
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/InheritanceMemberItem.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/InheritanceMemberItem.cs
Outdated
Show resolved
Hide resolved
| Overriding = 4, | ||
|
|
||
| /// <summary> | ||
| /// Indicate the target is overridden by the member. It would be shown as O↓. |
There was a problem hiding this comment.
i don't love us encoding this. it's unclear to me where we'll land in the future with the UI. but this is just docs, so i'm ok with it for now.
src/EditorFeatures/VisualBasic/InheritanceMargin/VisualBasicInheritanceMarginService.vb
Outdated
Show resolved
Hide resolved
src/EditorFeatures/VisualBasic/InheritanceMargin/VisualBasicInheritanceMarginService.vb
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/Shared/TestHooks/FeatureAttribute.cs
Outdated
Show resolved
Hide resolved
|
this is looking very good. no major concerns. almost all nits. |
…fne/roslyn into dev/shech/inheritanceMargin
src/EditorFeatures/Core.Wpf/InheritanceMargin/InheritanceMarginTaggerProvider.cs
Outdated
Show resolved
Hide resolved
| { | ||
| var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); | ||
| var allDeclarationNodes = GetMembers(root, spanToSearch); | ||
| var allDeclarationNodes = GetMembers(root.DescendantNodes(spanToSearch).ToImmutableArray()); |
There was a problem hiding this comment.
i'm on the fence about this DescendantNodes call. it will cause us to look at a lot of nodes. that isn't really awesome, esp as normally we would only have to find the TypeDecls, and that would be a very shallow and fast enumeration.
also, ToImmutableArray isn't really necessary here. it will force us to realize a potentially very large array full of pointers to nodes we don't care about.
There was a problem hiding this comment.
removed ToImmutableArray call.
I agree this might cause memory & perf problem and here are my thoughts.
- For this call, the searching might be faster if when we do DFS, stop and start backtracking if it meets method/property/etc.., it would save a lot cost. ( I could do it in following PRs)
- When I wrote this code, I was thinking we have many other command handler/ UI that requires knowing the inheritance chain info, we could cache these information per snapshot (maybe further, also per git commit?). But that's really a future work.
There was a problem hiding this comment.
For this call, the searching might be faster if when we do DFS, stop and start backtracking if it meets method/property/etc.., it would save a lot cost. ( I could do it in following PRs)
I think it's much easier than that. Just have each language walk the compilation unit, returning type declaration nodes. They only need to walk into namespaces, and into typedecls (because of nested types). they don't need to walk any further. this is a very quick walk that terminates quickly and only returns what is needed. then just process those type-decl nodes in order, gathering the members of interest.
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/InheritanceMargin/AbstractInheritanceMarginService.cs
Outdated
Show resolved
Hide resolved
I am guessing you are comment BaseTypeFinder.FindBaseTypesAndIntherfaces, it is returning ImmutableArray instread of ImmutableArray (doing an cast) I can update it |
What is added:
What's is not included: