Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refine code
  • Loading branch information
jdneo committed Feb 26, 2018
commit 0a7dc26780e32075fff4d146910958b9ac50655b
31 changes: 15 additions & 16 deletions src/commands/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,24 @@ export async function selectSession(channel: vscode.OutputChannel): Promise<void

async function parseSessionsToPicks(channel: vscode.OutputChannel): Promise<Array<IQuickItemEx<string>>> {
return new Promise(async (resolve: (res: Array<IQuickItemEx<string>>) => void): Promise<void> => {
let sessions: ISession[];
try {
sessions = await getSessionList(channel);
const sessions: ISession[] = await getSessionList(channel);
const picks: Array<IQuickItemEx<string>> = sessions.map((s: ISession) => Object.assign({}, {
label: `${s.active ? "$(check) " : ""}${s.name}`,
description: s.active ? "Active" : "",
detail: `AC Questions: ${s.acQuestions}, AC Submits: ${s.acSubmits}`,
value: s.id,
}));
picks.push({
label: "$(plus) Create a new session",
description: "",
detail: "Click this item to create a new session",
value: ":createNewSession",
});
resolve(picks);
} catch (error) {
return await promptForOpenOutputChannel("Failed to switch session. Please open the output channel for details", DialogType.error, channel);
return await promptForOpenOutputChannel("Failed to list sessions. Please open the output channel for details", DialogType.error, channel);
}
const picks: Array<IQuickItemEx<string>> = sessions.map((s: ISession) => Object.assign({}, {
label: `${s.active ? "$(check) " : ""}${s.name}`,
description: s.active ? "Active" : "",
detail: `AC Questions: ${s.acQuestions}, AC Submits: ${s.acSubmits}`,
value: s.id,
}));
picks.push({
label: "$(plus) Create a new session",
description: "",
detail: "Click this item to create a new session",
value: ":createNewSession",
});
resolve(picks);
});
}

Expand Down