-
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
Ensure the initial symbol a user searches for is top of hte find-refs list #43472
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5acc223
Ensure the initial symbol a user searches for is top of hte find-refs…
CyrusNajmabadi 5a215f3
Don't report find-monikers progress when no richnav system is present.
CyrusNajmabadi edbcd96
Remove progress tracking from richnav searching.
CyrusNajmabadi 9e6db8d
Tweak
CyrusNajmabadi aabc4b7
Tweak
CyrusNajmabadi 6ec123b
Don't collapse the other items
CyrusNajmabadi f023226
Merge remote-tracking branch 'upstream/master' into findRefsCollapsing
CyrusNajmabadi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,43 +43,37 @@ public VisualStudioFindSymbolMonikerUsagesService( | |
} | ||
|
||
public override async IAsyncEnumerable<ExternalReferenceItem> FindReferencesByMoniker( | ||
DefinitionItem definition, ImmutableArray<SymbolMoniker> monikers, | ||
IStreamingProgressTracker progress, [EnumeratorCancellation] CancellationToken cancellationToken) | ||
DefinitionItem definition, ImmutableArray<SymbolMoniker> monikers, [EnumeratorCancellation] CancellationToken cancellationToken) | ||
{ | ||
if (_codeIndexProvider == null) | ||
yield break; | ||
|
||
// Only grab the first 500 results. This keeps server load lower and is acceptable for //build demo purposes. | ||
const int PageCount = 5; | ||
Comment on lines
+51
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did this mean to come in this PR or something else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. i pulled this in from my main richnav PR (which i'm still trying to get in). |
||
|
||
var convertedMonikers = ConvertMonikers(monikers); | ||
var currentPage = 0; | ||
while (true) | ||
for (var currentPage = 0; currentPage < PageCount; currentPage++) | ||
{ | ||
var referenceItems = await FindReferencesByMonikerAsync( | ||
_codeIndexProvider, definition, convertedMonikers, progress, currentPage, cancellationToken).ConfigureAwait(false); | ||
_codeIndexProvider, definition, convertedMonikers, currentPage, cancellationToken).ConfigureAwait(false); | ||
|
||
// If we got no items, we're done. | ||
if (referenceItems.Length == 0) | ||
break; | ||
|
||
foreach (var item in referenceItems) | ||
yield return item; | ||
|
||
// Otherwise, we got some items. Return them to our caller and attempt to retrieve | ||
// another page. | ||
currentPage++; | ||
} | ||
} | ||
|
||
private async Task<ImmutableArray<ExternalReferenceItem>> FindReferencesByMonikerAsync( | ||
ICodeIndexProvider codeIndexProvider, DefinitionItem definition, ImmutableArray<ISymbolMoniker> monikers, | ||
IStreamingProgressTracker progress, int pageIndex, CancellationToken cancellationToken) | ||
ICodeIndexProvider codeIndexProvider, DefinitionItem definition, | ||
ImmutableArray<ISymbolMoniker> monikers, int pageIndex, CancellationToken cancellationToken) | ||
{ | ||
// Let the find-refs window know we have outstanding work | ||
await using var _1 = await progress.AddSingleItemAsync().ConfigureAwait(false); | ||
|
||
var results = await FindReferencesByMonikerAsync( | ||
codeIndexProvider, monikers, pageIndex, cancellationToken).ConfigureAwait(false); | ||
|
||
using var _2 = ArrayBuilder<ExternalReferenceItem>.GetInstance(out var referenceItems); | ||
using var _ = ArrayBuilder<ExternalReferenceItem>.GetInstance(out var referenceItems); | ||
|
||
foreach (var result in results) | ||
referenceItems.Add(ConvertResult(definition, result)); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
intentional removal. progress tracking doesn't work well for richnav as we don't really know how many items it will need to search. so trying to evne add progress items for it just ends up interfering with the good progress bar we have for the normal find-refs for user code in their solution.
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.
Ah, so we did all that refactoring work to then not use it? 😄
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's used elsewhere :) just here it's not particularly good and def degrades the experience. i.e. if you do have code-index, we just jump to the 50% point immediately because it says "i have one piece of work", and then finishes it. The other part of find refs has has added one piece of owrk that is not done, causing us to be at 1-of-2 done.
This is unlike normal find refs, which can add a bunch of known work it needs to do (like looking at all files with bloom filter matches) which gives far more fine-grained progress.