Skip to content

Move CallHierarchy logic to the Features layer#82864

Merged
JoeRobich merged 4 commits intomainfrom
dev/jorobich/move-call-hierarchy
Mar 31, 2026
Merged

Move CallHierarchy logic to the Features layer#82864
JoeRobich merged 4 commits intomainfrom
dev/jorobich/move-call-hierarchy

Conversation

@JoeRobich
Copy link
Copy Markdown
Member

@JoeRobich JoeRobich commented Mar 20, 2026

This is in preparation of implementing the LSP CallHierarchy handlers.

Microsoft Reviewers: Open in CodeFlow

@JoeRobich JoeRobich requested a review from a team as a code owner March 20, 2026 03:31
Comment on lines +49 to +59
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),
_ => [],
};
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic from the AbstractCallFinder merged into here.

Copy link
Copy Markdown
Member

@dibarbet dibarbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think looks good, just want to understand the threading around StartSearchWorker first

Comment thread src/Features/Core/Portable/CallHierarchy/CallHierarchySearchResult.cs Outdated
CancelSearch(categoryName);

var cancellationSource = new CancellationTokenSource();
_searches[categoryName] = cancellationSource;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JoeRobich JoeRobich force-pushed the dev/jorobich/move-call-hierarchy branch from fdf4326 to b76cc25 Compare March 31, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants