-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Have createQuickPick
no longer sort by label
#73904
Comments
I would like to implement this by adding a property |
I wonder if that would be sufficient. What about the highlighting of the search term on the labels? Would you want to turn that off too? |
@chrmarti highlighting the search term's not in the scope of this issue. Could you explain why you brought it up? I am concerned the sorting case in particular because this sort() call happens in the renderer itself. Since the extension API expects a list of items rather than a set or map, it seems logical to me to let the extension to decide that this list is already sorted and let the renderer save some processing time (especially for large lists). |
I don't want to add API without understanding the long-term direction and the highlighting, filtering and sorting all play into this. The QuickPickOptions already have matchOnDescription and matchOnDetail flags and these control filtering and highlighting. |
Thanks for responding! I also noticed that filter/highlight can only be toggled for the description and detail fields, not the label field. I imagine there was some kind of discussion when the API was originally added about its long-term vision; unfortunately that was before 'Hello Code' so it isn't in public history. Allowing the extension to decide whether to sort results will let it provide a better experience to the user any time the default metric of 'index of first match' is not the best one. For another example, an extension might want to keep the list grouped by category, similar to how built-in file search quickpick groups Recently opened, Search results, and Document symbols in that order. |
We could add |
After reading the discussion I still fail to understand how we went from optional sorting feature request to discussing filtering options which are not dependent on sorting in any way.... |
When you want to control sorting yourself, you probably also want to control filtering. I don't want to introduce a flag specific to sorting now only to discover that doesn't solve the entire issue. |
Combining filtering/sorting into a single flag seems reasonable to me: if an extension implements its own filter/sort, it can just set all the However highlighting probably can't be merged into the same flag, unless an extension could provide its own highlight ranges. It would be unfortunate if turning off sorting also requires giving up highlighting of the search query in the results. |
I agree that we should at least consider these things together even if we don't implement everything now. It's all about who controls the presentation of items in the quick pick. Also for example, if an extension has filtered and sorted based on its own algorithm, and vscode adds highlights based on a different algorithm, that might not make sense, so I could imagine a reason in the future to let extensions return highlight ranges too. But I'm guessing the filtering and sorting that you will do will be close enough to how our fuzzy matching logic works that you still want ours to apply. |
There is also the difficulty of the existing |
@chrmarti another option you could consider that would suit my requirements is adding an optional Lines 3329 to 3334 in fe1258b
|
My scenario is that I'm querying a web service based on the filter text which returns the first 10 results. I would like to add a final "Load more results..." item (alternatively a button) which loads the next batch. However, the automatic sorting prevents me from doing that as the next 10 results wouldn't appear below the first 10, but in a more or less random order, which would be confusing. My ask: an option to disable sorting but still have the highlighting enabled, together with using |
@pelmers Could you explain the scenario you need to control sorting for? Why is the built-in sorting not sufficient? We are having offline discussions whether or not we should allow that much control by the extensions over the UX. |
@chrmarti apologies on late reply, I never got a notification message on this thread. Here's some brief details to expand on the use case I outlined in the issue opener:
|
@Linskeyd It's on my list, I just haven't made it there yet. |
I'll merge the PR as proposed API with the flag for the Hope that makes sense. This will still need an API review before we can move it to the stable API. |
…tems when query changes Summary: 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. #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
ok since it sounds like we still can't skip sorting when the field has input, I'll reopen this issue. However @TylerLeonhardt please note #54400 is probably more specific to this case so maybe we should close this and reopen that instead. |
I'm not sure I understand why the filtering operation does any sorting at all. Is that an expected behavior of a filter? |
@TylerLeonhardt can this |
@TylerLeonhardt, would it be possible to also add this as an option to |
This iteration, we are planning on removing the sort logic for the bigger |
createQuickPick
no longer sort by label
@TylerLeonhardt I'm trying to understand how this won't be a breaking change. |
Right, yeah it's a change we'd like to make to get a read on how many extensions depend on the existing behavior. Our suspicion is that this existing behavior is hurting extensions more than it helps and thus the behavior of the API should change. Naturally, this is not an actual API breakage, since no API shape is changing... it's a behavior difference. There is a chance that such a change would cause issues... if so, we'll re-evaluate. |
Hi, I'm new to developing for VSCode and am very interested in this API-change (to create a go-to symbol that is closer to the one from sublime text), but seeing that it got put back into the backlog after being part of milestone twice is confusing to me. Does that mean it won't happen in the near future? Was it decided to not implement this change after all? |
Similar to #63050, I wish to avoid the final sort on the quick pick list. I am using the quickpick as a search field, and the
items
field I set is already sorted by my relevance metric, so I do not want to have VS Code sort the list again . Specifically, I want an option to skip this block:vscode/src/vs/workbench/browser/parts/quickinput/quickInputList.ts
Lines 518 to 523 in a69d0f8
The text was updated successfully, but these errors were encountered: