From a01a94f1a4c9741a3263518fd4bf2960b8f44560 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 8 Sep 2026 13:13:29 +0200 Subject: [PATCH] Offer launch.json generation from the startup project picker The one-time prompt is easy to miss, so the picker now ends with the same command, plus a solution picker. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_0169iPWwKHZoBTNN9qwXiwqk --- README.md | 5 +++-- src/extension.ts | 33 ++++++++++++++++++++++++--------- src/status.ts | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6623643..7f7dba8 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,9 @@ still runs after this one and fills in `justMyCode`, symbol options and the cons ### F5 -The first time it sees a solution the extension offers to write a `launch.json` entry -(*.NET Solution: Create launch.json and tasks.json entries* does it later): +The first time it sees a solution the extension offers to write a `launch.json` entry. +Later, run *.NET Solution: Create launch.json and tasks.json entries* from the command +palette, or pick it at the bottom of the startup-project list (click the project name): ```jsonc { diff --git a/src/extension.ts b/src/extension.ts index fcddeed..4eb2ca5 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -23,17 +23,32 @@ async function pickStartupProject(): Promise { : 'No solution found in the workspace.'); return; } - const picked = await vscode.window.showQuickPick( - candidates.map(project => ({ - label: project.info.name, - description: vscode.workspace.asRelativePath(project.info.fsPath, false), - detail: project.info.platforms.length ? `Platforms: ${project.info.platforms.join(', ')}` : undefined, - picked: project === model.startupProject, - project, - })), + type Item = vscode.QuickPickItem & { project?: StartupProject; action?: () => Promise }; + const items: Item[] = candidates.map(project => ({ + label: project.info.name, + description: vscode.workspace.asRelativePath(project.info.fsPath, false), + detail: project.info.platforms.length ? `Platforms: ${project.info.platforms.join(', ')}` : undefined, + picked: project === model.startupProject, + project, + })); + items.push( + { label: '', kind: vscode.QuickPickItemKind.Separator }, + { + label: '$(json) Create launch.json and tasks.json entries', + description: 'so F5 builds with the selected configuration', + action: generateLaunchConfig, + }, + { + label: '$(file-submodule) Select solution', + description: model.allSolutions.length > 1 ? `${model.allSolutions.length} found` : undefined, + action: pickSolution, + }); + const picked = await vscode.window.showQuickPick(items, { title: `${model.activeSolution?.name}: startup project`, matchOnDescription: true }); - if (picked) { + if (picked?.project) { await model.selectProject(picked.project); + } else if (picked?.action) { + await picked.action(); } } diff --git a/src/status.ts b/src/status.ts index bf77042..ba3e86d 100644 --- a/src/status.ts +++ b/src/status.ts @@ -72,7 +72,7 @@ export class StatusBar implements vscode.Disposable { `**Solution:** \`${solution.name}\` (${vscode.workspace.asRelativePath(solution.fsPath, false)})`, this.busy ? `\n$(loading~spin) ${this.busy}` : '', '', - 'Click to change the startup project.', + 'Click to change the startup project, or to create the launch.json / tasks.json entries.', ].join(' \n')); const mapped = `${active.projectConfiguration}|${active.projectPlatform}`;