-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor searching and reporting results in navto. #73249
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would require passing around the set though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah. don't care here :)
src/Features/LanguageServer/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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):