Skip to content

Commit

Permalink
hoist current binary
Browse files Browse the repository at this point in the history
  • Loading branch information
jribbink committed Apr 15, 2024
1 parent 4b266f8 commit 59bab00
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions extension/src/flow-cli/cli-selection-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ export class CliSelectionProvider {
// Update available versions
const items: Array<AvailableBinaryItem | CustomBinaryItem> = availableBinaries.map(binary => new AvailableBinaryItem(binary))
items.push(new CustomBinaryItem())
versionSelector.items = items

// Select the current binary
if (currentBinary !== null) {
const currentBinaryItem = versionSelector.items.find(item => item instanceof AvailableBinaryItem && item.path === currentBinary.path)
if (currentBinaryItem != null) {
versionSelector.selectedItems = [currentBinaryItem]
}
// Hoist the current binary to the top of the list
const currentBinaryIndex = items.findIndex(item => item instanceof AvailableBinaryItem && item.path === currentBinary?.path)
if (currentBinaryIndex != null) {
const currentBinaryItem = items[currentBinaryIndex]
items.splice(currentBinaryIndex, 1)
items.unshift(currentBinaryItem)
}

versionSelector.items = items
return versionSelector
}

Expand Down

0 comments on commit 59bab00

Please sign in to comment.