-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[scm] the order of icon in scm is different in Chrom and Firefox #5620
Comments
@kpge Will you have chance to investigate the cause? PRs are welcomed if they don't involve big structural changes. |
Isn’t the comparator function the strange? Assuming I have
When I compare them, them following branch will return with
Meaning that |
Could someone look at the comparator? It seems to be relatively easy fix. The logic should be following:
It seems that the last point is not true for items within the navigator group. |
diff --git a/packages/core/src/browser/shell/tab-bar-toolbar.tsx b/packages/core/src/browser/shell/tab-bar-toolbar.tsx
index 8978286cc..a6caeaccd 100644
--- a/packages/core/src/browser/shell/tab-bar-toolbar.tsx
+++ b/packages/core/src/browser/shell/tab-bar-toolbar.tsx
@@ -292,26 +292,18 @@ export namespace TabBarToolbarItem {
*/
export const PRIORITY_COMPARATOR = (left: TabBarToolbarItem, right: TabBarToolbarItem) => {
// The navigation group is special as it will always be sorted to the top/beginning of a menu.
- if (left.group === undefined || left.group === 'navigation') {
- return 1;
- }
- if (right.group === undefined || right.group === 'navigation') {
- return -1;
- }
- if (left.group && right.group) {
- if (left.group < right.group) {
- return -1;
- } else if (left.group > right.group) {
- return 1;
- } else {
- return 0;
+ const compareGroup = (leftGroup: string | undefined = 'navigation', rightGroup: string | undefined = 'navigation') => {
+ if (leftGroup === 'navigation') {
+ return rightGroup === 'navigation' ? 0 : -1;
}
- }
- if (left.group) {
- return -1;
- }
- if (right.group) {
- return 1;
+ if (rightGroup === 'navigation') {
+ return leftGroup === 'navigation' ? 0 : 1;
+ }
+ return leftGroup.localeCompare(rightGroup);
+ };
+ const result = compareGroup(left.group, right.group);
+ if (result !== 0) {
+ return result;
}
return (left.priority || 0) - (right.priority || 0);
}; ? |
I will take care of it. |
Closes #5620. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
Closes #5620. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
Closes #5620. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
Description
the order of command icon in scm is different in Chrom and Firefox

Reproduction Steps
OS and Theia version:
Diagnostics:
The text was updated successfully, but these errors were encountered: