Ignore case when sorting command palette #11619

Closed
opened 2026-01-31 02:52:41 +00:00 by claunia · 4 comments
Owner

Originally created by @Don-Vito on GitHub (Nov 28, 2020).

Originally assigned to: @Don-Vito on GitHub.

Description of the new feature/enhancement

I took me a while to understand why custom commands I add appear at the bottom.
The reason is that when sorting commands in command palette we do it not lexicographically and as a result consider a case.

IMHO the case should not matter in the palette (or at least case-insensitive sorting should be optionally available).

Proposed technical implementation details (optional)

Upon comparing the filtered commands, try to set both command names to lower case and then compare lexicographically.

Originally created by @Don-Vito on GitHub (Nov 28, 2020). Originally assigned to: @Don-Vito on GitHub. # Description of the new feature/enhancement I took me a while to understand why custom commands I add appear at the bottom. The reason is that when sorting commands in command palette we do it not lexicographically and as a result consider a case. IMHO the case should not matter in the palette (or at least case-insensitive sorting should be optionally available). # Proposed technical implementation details (optional) Upon comparing the filtered commands, try to set both command names to lower case and then compare lexicographically.
Author
Owner

@Don-Vito commented on GitHub (Nov 29, 2020):

@DHowett - actually I am not sure what to do 🤔

As @j4james mentioned correctly here, case is just a subset of a larger problem and will not solve accented chars, etc.

And the larger problem is described here: https://github.com/microsoft/terminal/issues/6953 - we need to use correct locale for comparison.

When I last talked to @zadjii-msft we decided that probably we should not invest in it, since in any case we want to implement https://github.com/microsoft/terminal/issues/7039 - that says not to localize the palette at all.

So now I am on the crossroads of:
1. Do nothing (hate this one)
2. Work on https://github.com/microsoft/terminal/issues/7039 (though I am not sure how to advance there - are the US_English resources packed by default in addition to other languages?)
3. Work on https://github.com/microsoft/terminal/issues/6953 - try to read the user locale and use it
4. Simply compare the strings in lowercase (will probably help only for ascii characters)

WDYT?

@Don-Vito commented on GitHub (Nov 29, 2020): ~~@DHowett - actually I am not sure what to do 🤔~~ ~~As @j4james mentioned correctly [here](https://github.com/microsoft/terminal/pull/8432#issuecomment-735304273), case is just a subset of a larger problem and will not solve accented chars, etc.~~ ~~And the larger problem is described here: https://github.com/microsoft/terminal/issues/6953 - we need to use correct locale for comparison.~~ ~~When I last talked to @zadjii-msft we decided that probably we should not invest in it, since in any case we want to implement https://github.com/microsoft/terminal/issues/7039 - that says not to localize the palette at all.~~ ~~So now I am on the crossroads of:~~ ~~1. Do nothing (hate this one)~~ ~~2. Work on https://github.com/microsoft/terminal/issues/7039 (though I am not sure how to advance there - are the US_English resources packed by default in addition to other languages?)~~ ~~3. Work on https://github.com/microsoft/terminal/issues/6953 - try to read the user locale and use it~~ ~~4. Simply compare the strings in lowercase (will probably help only for ascii characters)~~ ~~WDYT?~~
Author
Owner

@j4james commented on GitHub (Nov 29, 2020):

Wow. I had no idea this issue was so complicated. But my understanding from reading #7039, is that VS is not just leaving the palette in English - it's listing both the native language as well as English, and allowing the search to match both of them. In that case, it still makes sense to sort with the user's native locale I would think.

If the plan is to not show the native language at all, then I guess a hardcoded US-EN locale may be best (assuming that is always available). But worst case I'd think the user's native locale would probably still be reasonable for sorting, even on English text - at least it can't be worse than ASCII ordering and seems neater than lowercasing everything (which can produce inconsistent results).

@j4james commented on GitHub (Nov 29, 2020): Wow. I had no idea this issue was so complicated. But my understanding from reading #7039, is that VS is not just leaving the palette in English - it's listing both the native language as well as English, and allowing the search to match both of them. In that case, it still makes sense to sort with the user's native locale I would think. If the plan is to not show the native language at all, then I guess a hardcoded US-EN locale may be best (assuming that is always available). But worst case I'd think the user's native locale would probably still be reasonable for sorting, even on English text - at least it can't be worse than ASCII ordering and seems neater than lowercasing everything (which can produce inconsistent results).
Author
Owner

@zadjii-msft commented on GitHub (Nov 29, 2020):

For the record, this seems fine to me, we'll loop back around on the "always display the EN-US command name" thing later, let's just start with this since it's a good low-hanging fix

@zadjii-msft commented on GitHub (Nov 29, 2020): For the record, this seems fine to me, we'll loop back around on the "always display the EN-US command name" thing later, let's just start with this since it's a good low-hanging fix
Author
Owner

@ghost commented on GitHub (Jan 28, 2021):

:tada:This issue was addressed in #8432, which has now been successfully released as Windows Terminal Preview v1.6.10272.0.🎉

Handy links:

@ghost commented on GitHub (Jan 28, 2021): :tada:This issue was addressed in #8432, which has now been successfully released as `Windows Terminal Preview v1.6.10272.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.6.10272.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11619