diff --git a/extension/package-lock.json b/extension/package-lock.json index 1da7f32d419..bca9234a0fb 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "aspire-vscode", - "version": "0.3.0", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aspire-vscode", - "version": "0.3.0", + "version": "0.4.0", "license": "SEE LICENSE IN LICENSE.TXT", "dependencies": { "@vscode/extension-telemetry": "^1.0.0", diff --git a/extension/src/server/interactionService.ts b/extension/src/server/interactionService.ts index 924292420cd..ccdb32f9e0f 100644 --- a/extension/src/server/interactionService.ts +++ b/extension/src/server/interactionService.ts @@ -131,12 +131,13 @@ export class InteractionService implements IInteractionService { const yes = yesLabel; const no = noLabel; - const result = await vscode.window.showInformationMessage( - formatText(promptText), - { modal: true }, - yes, - no - ); + const choices = [yes, no]; + + const result = await vscode.window.showQuickPick(choices, { + placeHolder: formatText(promptText), + canPickMany: false, + ignoreFocusOut: true + }); if (result === yes) { return true; diff --git a/extension/src/test/rpc/interactionServiceTests.test.ts b/extension/src/test/rpc/interactionServiceTests.test.ts index f05e49f326b..b26097994c0 100644 --- a/extension/src/test/rpc/interactionServiceTests.test.ts +++ b/extension/src/test/rpc/interactionServiceTests.test.ts @@ -78,6 +78,41 @@ suite('InteractionService endpoints', () => { showInputBoxStub.restore(); }); + // confirm + test('confirm returns true when Yes is selected', async () => { + const testInfo = await createTestRpcServer(); + const showQuickPickStub = sinon.stub(vscode.window, 'showQuickPick').resolves('Yes' as any); + const result = await testInfo.interactionService.confirm('Are you sure?', true); + assert.strictEqual(result, true); + assert.ok(showQuickPickStub.calledOnce, 'showQuickPick should be called once'); + + // Verify options passed to showQuickPick + const callArgs = showQuickPickStub.getCall(0).args; + assert.deepStrictEqual(callArgs[0], ['Yes', 'No'], 'should show Yes and No choices'); + assert.strictEqual(callArgs[1]?.canPickMany, false, 'canPickMany should be false'); + assert.strictEqual(callArgs[1]?.ignoreFocusOut, true, 'ignoreFocusOut should be true'); + + showQuickPickStub.restore(); + }); + + test('confirm returns false when No is selected', async () => { + const testInfo = await createTestRpcServer(); + const showQuickPickStub = sinon.stub(vscode.window, 'showQuickPick').resolves('No' as any); + const result = await testInfo.interactionService.confirm('Are you sure?', false); + assert.strictEqual(result, false); + assert.ok(showQuickPickStub.calledOnce, 'showQuickPick should be called once'); + showQuickPickStub.restore(); + }); + + test('confirm returns null when cancelled', async () => { + const testInfo = await createTestRpcServer(); + const showQuickPickStub = sinon.stub(vscode.window, 'showQuickPick').resolves(undefined); + const result = await testInfo.interactionService.confirm('Are you sure?', true); + assert.strictEqual(result, null); + assert.ok(showQuickPickStub.calledOnce, 'showQuickPick should be called once'); + showQuickPickStub.restore(); + }); + test('displayError endpoint', async () => { const testInfo = await createTestRpcServer(); const showErrorMessageSpy = sinon.spy(vscode.window, 'showErrorMessage'); diff --git a/extension/yarn.lock b/extension/yarn.lock index b8d65f2d611..ec7851d07e7 100644 --- a/extension/yarn.lock +++ b/extension/yarn.lock @@ -1006,10 +1006,10 @@ ora "^8.1.0" semver "^7.6.2" -"@vscode/vsce-sign-win32-x64@2.0.2": +"@vscode/vsce-sign-linux-x64@2.0.2": version "2.0.2" - resolved "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.2.tgz" - integrity sha1-KU6nK0T+3WlNSfXO9MVb84dtwlc= + resolved "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.2.tgz" + integrity sha1-WauT8yLvs89JFm1OLoEnicMRdCg= "@vscode/vsce-sign@^2.0.0": version "2.0.5"