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

Add optional sortByLabel to QuickPick to control whether to re-sort results #77297

Closed
wants to merge 2 commits into from

Conversation

pelmers
Copy link
Contributor

@pelmers pelmers commented Jul 12, 2019

Address issue #73904 by adding an optional sortByLabel to the QuickPick class which determines whether the picker re-sorts the result list when the user types in the input field.

If true, the picker applies a sort to order results by the index of the first appearance of the input in the label.

For backwards compatibility, this field is true by default.

@chrmarti, @roblourens

Notes:
This is just a first pass the implements my initial request -- it doesn't add more fields for highlighting or behaviors that touch fields other than the label.

And I realize that most of the API makes optional params 'false' by default, I'm happy to rename this one to fit that pattern too if requested (e.g. disableSortByLabel: false).

Tested with both 'createQuickPick' and 'showQuickPick' from an extension.

…tems when query changes

Summary:
Address issue microsoft#73904 by adding an optional `sortByLabel` to the QuickPick class which determines whether the picker re-sorts the result list when the user types in the input field.

If true, the picker applies a sort to order results by the index of the first appearance of the input in the label.

For backwards compatibility, this field is true by default.

microsoft#73904

Test Plan:
attached video shows behavior both before and after

{F167292605}

note: there aren't any existing tests on what happens when the query input changes in the QuickPick

Reviewers: dalongi, ericblue, hchau

Reviewed By: ericblue

Differential Revision: https://phabricator.intern.facebook.com/D16203434

Signature: 16203434:1562878837:5413e3852f2bd04c8e81b9fe5c4a08127dfe3b65
@msftclas
Copy link

msftclas commented Jul 12, 2019

CLA assistant check
All CLA requirements met.

/**
* An optional flag to sort the final results by index of first query match in label, defaults to true.
*/
sortByLabel?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

These changes should be in vscode.proposed.d.ts, new API starts there until we decide to release it as stable API. More info: https://github.com/Microsoft/vscode/wiki/Extension-API-process

Summary: API additions should start off in the proposed API file.

Test Plan:
same as before, tested that I could skip sorting:
{F168164535}

Reviewers: dalongi, ericblue, hchau

Reviewed By: ericblue

Differential Revision: https://phabricator.intern.facebook.com/D16264910

Signature: 16264910:1563214616:55ecf86a9d4a0d8a0cd44d9b33eb770b2a7d04aa
@pelmers
Copy link
Contributor Author

pelmers commented Jul 16, 2019

added a region to proposed.d.ts with the changes, I put my name there as well but I'm not sure if I followed the convention correctly

@chrmarti chrmarti added this to the August 2019 milestone Aug 15, 2019
@alexdima alexdima modified the milestones: August 2019, September 2019 Aug 27, 2019
@mjbvz mjbvz modified the milestones: September 2019, October 2019 Oct 10, 2019
@chrmarti chrmarti added the quick-pick Quick-pick widget issues label Oct 24, 2019
@chrmarti chrmarti modified the milestones: October 2019, November 2019 Oct 28, 2019
@chrmarti
Copy link
Contributor

Merged manually. Thanks @pelmers !

@chrmarti chrmarti closed this Nov 18, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
quick-pick Quick-pick widget issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants