Skip to content
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

support for fastAndSlow picks #191002

Merged
merged 19 commits into from
Aug 23, 2023
Merged

Conversation

andreamah
Copy link
Contributor

@andreamah andreamah commented Aug 22, 2023

Fixes #190767

Mostly refactors search to support sync results. This uses the FastAndSlowPicks API in quick access to return synchronous results before async results. The search function in the SearchModel should now return a sync and async result (two results), where the async result should resolve at the same point that the original single search return value resolved.

Sync results -> open text editors
Async results -> closed text editors, notebook (open editors and closed)

Related polish items:

@andreamah andreamah self-assigned this Aug 22, 2023
@andreamah andreamah requested a review from roblourens August 22, 2023 21:06
@andreamah andreamah marked this pull request as ready for review August 22, 2023 21:06
@vscodenpa vscodenpa added this to the August 2023 milestone Aug 22, 2023
Comment on lines 207 to 210
return {
picks: [],
additionalPicks: Promise.resolve([])
};
Copy link
Member

Choose a reason for hiding this comment

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

return null here maybe

return this.searchModel.searchResult.matches().filter(e => result.syncResults.indexOf(e) === -1);
};
return {
syncResults: this.searchModel.searchResult.matches(),
Copy link
Member

Choose a reason for hiding this comment

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

Why not return result.syncResults here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

matches() in the searchresult are the non-raw matches

@@ -2046,11 +2075,21 @@ export class SearchModel extends Disposable {
// In search on type case, delay the streaming of results just a bit, so that we don't flash the only "local results" fast path
this._startStreamDelay = new Promise(resolve => setTimeout(resolve, this.searchConfig.searchOnType ? 150 : 0));

const currentRequest = this.doSearch(query, progressEmitter, this._searchQuery, searchInstanceID, onProgress);
const req = this.doSearch(query, progressEmitter, this._searchQuery, searchInstanceID, onProgress, callerTokenSource);
Copy link
Member

Choose a reason for hiding this comment

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

What's this ID for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Webview results in notebooks needs an owner ID so that we can add and remove decorations properly

Copy link
Member

Choose a reason for hiding this comment

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

I know it's not part of this PR but I'd think you could do that without exposing this webview thing all the way up at this layer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason why it needs to be at the search model layer is because FileMatches that are part of the same search need to know the searchInstanceID to correctly remove webview decorations. Saying "I send a command from the search view to remove decorations from the webview" did not work, as there was a race condition with the new search starting to add its decorations before the old search instance began to dispose. I created #191106 to track the polish of this work, as I agree it's strange to have this so far away from the webview work.

src/vs/workbench/contrib/search/browser/searchModel.ts Outdated Show resolved Hide resolved
src/vs/workbench/contrib/search/browser/searchModel.ts Outdated Show resolved Hide resolved
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

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

Looks good from QuickAccess side!

@andreamah andreamah merged commit 2e95e03 into main Aug 23, 2023
@andreamah andreamah deleted the andrea/quick-search-open-files-first branch August 23, 2023 15:20
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

quick text search: show open files first
4 participants