Skip to content

Commit 279d52d

Browse files
committed
Changed get samples quick input to display load samples first
1 parent 3c2d565 commit 279d52d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/project_utilities/project.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,31 +166,36 @@ export async function createNewProjectFromSample(wsConfig: WorkspaceConfig) {
166166
return;
167167
}
168168

169+
// Show loading QuickPick with no items, just a placeholder
170+
const loadingQuickPick = vscode.window.createQuickPick();
171+
loadingQuickPick.items = [];
172+
loadingQuickPick.busy = true;
173+
loadingQuickPick.enabled = false;
174+
loadingQuickPick.placeholder = "Loading sample projects... Please wait.";
175+
loadingQuickPick.show();
176+
169177
const samplesDir = await getSamples(wsConfig.activeSetupState);
170-
const projectList: vscode.QuickPickItem[] = samplesDir.map(x => ({ label: x[1], detail: "(" + x[0] + ") " + x[3], description: x[2] }));
171178

179+
loadingQuickPick.hide();
180+
181+
// Show sample selection QuickPick as usual
182+
const projectList: vscode.QuickPickItem[] = samplesDir.map(x => ({ label: x[1], detail: "(" + x[0] + ") " + x[3], description: x[2] }));
172183
const pickOptions: vscode.QuickPickOptions = {
173184
ignoreFocusOut: true,
174185
matchOnDescription: true,
175186
placeHolder: "Select Sample Project",
176187
};
177-
178188
let selectedSample = await vscode.window.showQuickPick(projectList, pickOptions);
179189
if (selectedSample && selectedSample.detail && selectedSample.label) {
180190
let selectedSamplePath = selectedSample.detail.split(") ")[1];
181-
182191
const projectDest = await vscode.window.showInputBox({ title: "Choose Project Destination", value: path.basename(selectedSamplePath) });
183-
184192
if (projectDest) {
185193
const destinationPath = path.join(wsConfig.rootPath, projectDest);
186-
187-
188194
fs.cpSync(selectedSamplePath, destinationPath, { recursive: true });
189195
let newProjectName = path.basename(projectDest);
190196
if (selectedSample.label !== newProjectName) {
191197
changeProjectNameInCMakeFile(destinationPath, newProjectName);
192198
}
193-
194199
return destinationPath;
195200
}
196201
}

0 commit comments

Comments
 (0)