Skip to content

Commit feadb1e

Browse files
committed
✨ Show all available actions in the button as a menu
1 parent e3a6eb8 commit feadb1e

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
{
3333
"command": "ralph-runner.openSettings",
3434
"title": "RALPH: Open Settings"
35+
},
36+
{
37+
"command": "ralph-runner.showMenu",
38+
"title": "RALPH: Show Menu"
3539
}
3640
],
3741
"configuration": {

src/extension.ts

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ export function activate(context: vscode.ExtensionContext) {
116116
// ── Status bar icon ────────────────────────────────────────────────────
117117
statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 100);
118118
statusBarItem.text = '$(rocket) RALPH';
119-
statusBarItem.tooltip = 'RALPH Runner — click to open settings';
120-
statusBarItem.command = 'ralph-runner.openSettings';
119+
statusBarItem.tooltip = 'RALPH Runner — click to show commands';
120+
statusBarItem.command = 'ralph-runner.showMenu';
121121
statusBarItem.show();
122122
context.subscriptions.push(statusBarItem);
123123

@@ -128,7 +128,8 @@ export function activate(context: vscode.ExtensionContext) {
128128
vscode.commands.registerCommand('ralph-runner.resetStep', () => resetStep()),
129129
vscode.commands.registerCommand('ralph-runner.openSettings', () => {
130130
vscode.commands.executeCommand('workbench.action.openSettings', 'ralph-runner');
131-
})
131+
}),
132+
vscode.commands.registerCommand('ralph-runner.showMenu', () => showCommandMenu())
132133
);
133134

134135
log('RALPH Runner extension activated.');
@@ -797,11 +798,40 @@ function updateStatusBar(state: 'idle' | 'running'): void {
797798
if (!statusBarItem) { return; }
798799
if (state === 'running') {
799800
statusBarItem.text = '$(sync~spin) RALPH';
800-
statusBarItem.tooltip = 'RALPH Runner — migration in progress (click for settings)';
801+
statusBarItem.tooltip = 'RALPH Runner — migration in progress (click for menu)';
801802
statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground');
802803
} else {
803804
statusBarItem.text = '$(rocket) RALPH';
804-
statusBarItem.tooltip = 'RALPH Runner — click to open settings';
805+
statusBarItem.tooltip = 'RALPH Runner — click to show commands';
805806
statusBarItem.backgroundColor = undefined;
806807
}
807808
}
809+
810+
async function showCommandMenu(): Promise<void> {
811+
const items: vscode.QuickPickItem[] = [
812+
{ label: '$(play) Start Migration', description: 'Begin or resume the autonomous migration loop' },
813+
{ label: '$(debug-stop) Stop Migration', description: 'Cancel the current migration run' },
814+
{ label: '$(info) Show Status', description: 'Display migration progress summary' },
815+
{ label: '$(debug-restart) Reset Step', description: 'Reset a completed or failed step to pending' },
816+
{ label: '$(gear) Open Settings', description: 'Configure RALPH Runner options' },
817+
];
818+
819+
const selected = await vscode.window.showQuickPick(items, {
820+
placeHolder: 'RALPH Runner — select a command',
821+
});
822+
823+
if (!selected) { return; }
824+
825+
const commandMap: Record<string, string> = {
826+
'$(play) Start Migration': 'ralph-runner.start',
827+
'$(debug-stop) Stop Migration': 'ralph-runner.stop',
828+
'$(info) Show Status': 'ralph-runner.status',
829+
'$(debug-restart) Reset Step': 'ralph-runner.resetStep',
830+
'$(gear) Open Settings': 'ralph-runner.openSettings',
831+
};
832+
833+
const cmd = commandMap[selected.label];
834+
if (cmd) {
835+
vscode.commands.executeCommand(cmd);
836+
}
837+
}

0 commit comments

Comments
 (0)