Skip to content

Commit 5626ca7

Browse files
authored
Add confirmation step for XML export (#1514)
1 parent c03deb4 commit 5626ca7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/commands/export.ts

+21
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,27 @@ export async function exportDocumentsToXMLFile(): Promise<void> {
343343
if (documents.length == 0) {
344344
return;
345345
}
346+
// Prompt the user to confirm their choices
347+
const confirmed = await new Promise<boolean>((resolve) => {
348+
const quickPick = vscode.window.createQuickPick();
349+
quickPick.title = `Export the following ${documents.length > 1 ? `${documents.length} documents` : "document"}?`;
350+
quickPick.placeholder = "Click any item to confirm, or 'Escape' to cancel";
351+
quickPick.ignoreFocusOut = true;
352+
quickPick.onDidChangeSelection((e) => outputChannel.appendLine(JSON.stringify(e)));
353+
quickPick.onDidAccept(() => {
354+
resolve(true);
355+
quickPick.hide();
356+
});
357+
quickPick.onDidHide(() => {
358+
resolve(false);
359+
quickPick.dispose();
360+
});
361+
quickPick.items = documents.sort().map((d) => {
362+
return { label: d };
363+
});
364+
quickPick.show();
365+
});
366+
if (!confirmed) return;
346367
// Prompt the user for the export destination
347368
const uri = await vscode.window.showSaveDialog({
348369
saveLabel: "Export",

0 commit comments

Comments
 (0)