Move CallHierarchy logic to the Features layer#82864
Conversation
| return searchDescriptor.Relationship switch | ||
| { | ||
| CallHierarchyRelationshipKind.Callers or | ||
| CallHierarchyRelationshipKind.BaseMember or | ||
| CallHierarchyRelationshipKind.InterfaceImplementations or | ||
| CallHierarchyRelationshipKind.FieldReferences => await SearchCallersAsync(symbol, project, documents, cancellationToken).ConfigureAwait(false), | ||
| CallHierarchyRelationshipKind.CallsToOverrides => await SearchCallsToOverridesAsync(symbol, project, documents, cancellationToken).ConfigureAwait(false), | ||
| CallHierarchyRelationshipKind.Implementations => await SearchImplementationsAsync(symbol, project, documents, cancellationToken).ConfigureAwait(false), | ||
| CallHierarchyRelationshipKind.Overrides => await SearchOverridesAsync(symbol, project, documents, cancellationToken).ConfigureAwait(false), | ||
| _ => [], | ||
| }; |
There was a problem hiding this comment.
This various Finder logic merged into this service.
| } | ||
|
|
||
| public async Task<ImmutableArray<AbstractCallFinder>> CreateFindersAsync(ISymbol symbol, Project project, CancellationToken cancellationToken) | ||
| public async Task<ImmutableArray<CallHierarchySearchResult>> SearchAsync( |
There was a problem hiding this comment.
Logic from the AbstractCallFinder merged into here.
dibarbet
left a comment
There was a problem hiding this comment.
I think looks good, just want to understand the threading around StartSearchWorker first
| CancelSearch(categoryName); | ||
|
|
||
| var cancellationSource = new CancellationTokenSource(); | ||
| _searches[categoryName] = cancellationSource; |
There was a problem hiding this comment.
What are the threading guarantees here, would be good to doc. For example is it possible for this to get called concurrently?
Assume this gets called on the main thread, hence the need for the Task.Run?
There was a problem hiding this comment.
Added a comment. Concurrent searches in different categories can run in parallel.
You are right that this does get called from a UI thread and we move to a background thread with Task.Run.
fdf4326 to
b76cc25
Compare
This is in preparation of implementing the LSP CallHierarchy handlers.
Microsoft Reviewers: Open in CodeFlow