Refactor searching and reporting results in navto. #73249
Refactor searching and reporting results in navto. #73249CyrusNajmabadi merged 42 commits intodotnet:mainfrom
Conversation
| IEnumerable<T> items, | ||
| Func<T, Action<RoslynNavigateToItem>, CancellationToken, ValueTask> callback, | ||
| Func<ImmutableArray<RoslynNavigateToItem>, Task> onItemsFound, | ||
| CancellationToken cancellationToken) |
There was a problem hiding this comment.
this is hte core utility that all 3 nav-to search functions end up deferring to (search normal docs. search generated docs. search cached docs).
| }, cancellationToken)); | ||
| } | ||
|
|
||
| await Task.WhenAll(tasks).ConfigureAwait(false); |
There was a problem hiding this comment.
poor man's solution. I consider copying the runtime code and forking into roslyn. but it was complex enough i didn't want us to main that. And that code should not run here as this is the searching part, which should run in OOP on VS and on netcore for vscode anyways. (And it's the same logic as before, so no worse for any other client that was previously using hte old codepaths).
src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs
Outdated
Show resolved
Hide resolved
|
@ToddGrun for eyes. |
src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.cs
Show resolved
Hide resolved
| nameMatcher.AddMatches(declaredSymbolInfo.Name, ref nameMatches.AsRef()) && | ||
| containerMatcher?.AddMatches(declaredSymbolInfo.FullyQualifiedContainerName, ref containerMatches.AsRef()) != false) | ||
| { | ||
| if (cancellationToken.IsCancellationRequested) |
There was a problem hiding this comment.
i kept this as addmatches is the expensive step. so this lets us bail after doing that check.
| } | ||
|
|
||
| result.RemoveDuplicates(); | ||
| return result.ToImmutableAndClear(); |
There was a problem hiding this comment.
it wasn't necessary. this is for getting siblings, which alreadywill only be for unique projects.
|
|
||
| var results = new ConcurrentSet<RoslynNavigateToItem>(); | ||
| await SearchSingleDocumentAsync( | ||
| document, patternName, patternContainerOpt, declaredSymbolInfoKindsSet, t => results.Add(t), cancellationToken).ConfigureAwait(false); |
There was a problem hiding this comment.
would require passing around the set though
There was a problem hiding this comment.
yeah. don't care here :)
Local traces were showing a few sources of inefficiency when doing a NavTo search in a large solution (esp. durign the typing phase of writing the query):