Skip to content

Commit 717d3ac

Browse files
CopilotTyriar
andcommitted
Fix test format errors and improve main/master branch ordering
Co-authored-by: Tyriar <[email protected]>
1 parent 1843a3c commit 717d3ac

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalCompletionModel.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ const compareCompletionsFn = (leadingLineContent: string, a: TerminalCompletionI
5151
if (bIsMainOrMaster && !aIsMainOrMaster) {
5252
return 1;
5353
}
54+
55+
// When both are main/master, prioritize main over master
56+
if (aIsMainOrMaster && bIsMainOrMaster) {
57+
if (aLabel === 'main' && bLabel === 'master') {
58+
return -1;
59+
}
60+
if (aLabel === 'master' && bLabel === 'main') {
61+
return 1;
62+
}
63+
}
5464
}
5565

5666
// Sort by the score

src/vs/workbench/contrib/terminalContrib/suggest/test/browser/terminalCompletionModel.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,7 @@ suite('TerminalCompletionModel', function () {
357357
createItem({ label: { label: 'main', description: 'Main branch' }, provider: 'terminal-suggest' })
358358
];
359359
const model = new TerminalCompletionModel(items, new LineContext('git checkout ', 0));
360-
assertItems(model, [
361-
{ label: 'main', description: 'Main branch' },
362-
{ label: 'master', description: 'Master branch' },
363-
{ label: 'feature-branch', description: 'Feature branch' }
364-
]);
360+
assertItems(model, ['main', 'master', 'feature-branch']);
365361
});
366362
});
367363
});

0 commit comments

Comments
 (0)