Skip to content

Commit

Permalink
Show progress in target picker if listing takes time
Browse files Browse the repository at this point in the history
  • Loading branch information
nisargjhaveri committed Jun 20, 2023
1 parent bd98631 commit 79911e9
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions src/targetPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,32 @@ function _getTarget(): Target|undefined
// Command callbacks
export async function pickTarget()
{
let targets = await listTargets();
let quickPickItems = targets
.sort((a, b) => {
if (a.type !== b.type) {
return a.type.localeCompare(b.type);
}
if (a.type === "Simulator") {
const simA = a as Simulator;
const simB = b as Simulator;
if (simA.state !== simB.state) {
return simA.state === "Booted" ? -1 : simB.state === "Booted" ? 1 : 0;
let quickPickItems = listTargets().then((targets) => {
return targets
.sort((a, b) => {
if (a.type !== b.type) {
return a.type.localeCompare(b.type);
}
}

return 0;
})
.map((t): TargetQuickPickItem => ({
label: t.name,
description:
(t.type === "Simulator") ?
(t as Simulator).state === "Booted" ? "Booted" : "" :
(t as Device).modelName,
detail: `${t.type}${t.runtime}`,
target: t,
}));
if (a.type === "Simulator") {
const simA = a as Simulator;
const simB = b as Simulator;
if (simA.state !== simB.state) {
return simA.state === "Booted" ? -1 : simB.state === "Booted" ? 1 : 0;
}
}

return 0;
})
.map((t): TargetQuickPickItem => ({
label: t.name,
description:
(t.type === "Simulator") ?
(t as Simulator).state === "Booted" ? "Booted" : "" :
(t as Device).modelName,
detail: `${t.type}${t.runtime}`,
target: t,
}));
});

let quickPickOptions: vscode.QuickPickOptions = {
title: "Select iOS Target",
Expand Down

0 comments on commit 79911e9

Please sign in to comment.