Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extension/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions extension/src/server/interactionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
35 changes: 35 additions & 0 deletions extension/src/test/rpc/interactionServiceTests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Comment on lines +88 to +94
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the blank line 88 before the comment. According to the .editorconfig formatting guidelines, unnecessary blank lines should be avoided within test method bodies.

Suggested change
// 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');
// 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');

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the blank line 94 before showQuickPickStub.restore(). The extra whitespace is inconsistent with the other test methods in this file (see lines 103-104 and 112-113 where restore() follows immediately after the assertion).

Suggested change

Copilot uses AI. Check for mistakes.
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');
Expand Down
6 changes: 3 additions & 3 deletions extension/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1006,10 +1006,10 @@
ora "^8.1.0"
semver "^7.6.2"

"@vscode/vsce-sign-win32[email protected]":
"@vscode/vsce-sign-linux[email protected]":
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"
Expand Down