Skip to content

Commit 29f800e

Browse files
Copilotalexr00
andauthored
Keep checkout picker changes in existing files
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 80bf8c7 commit 29f800e

4 files changed

Lines changed: 31 additions & 39 deletions

File tree

src/commands.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ import { CopilotRemoteAgentManager, SessionIdForPr } from './github/copilotRemot
2424
import { guessExtensionFromMime, pickFilesForUpload, placeholdersForNames, runFileUploads, runPendingUploads } from './github/fileUpload';
2525
import { FolderRepositoryManager } from './github/folderRepositoryManager';
2626
import { GitHubRepository } from './github/githubRepository';
27+
import type { PullRequestNumberData } from './github/graphql';
2728
import { Issue } from './github/interface';
2829
import { IssueModel } from './github/issueModel';
2930
import { IssueOverviewPanel } from './github/issueOverview';
3031
import { GHPRComment, GHPRCommentThread, TemporaryComment } from './github/prComment';
3132
import { PullRequestModel } from './github/pullRequestModel';
3233
import { PullRequestOverviewPanel } from './github/pullRequestOverview';
33-
import { getPullRequestQuickPickItem } from './github/pullRequestQuickPick';
3434
import { chooseItem } from './github/quickPicks';
3535
import { RepositoriesManager } from './github/repositoriesManager';
3636
import { codespacesPrLink, getIssuesUrl, getPullsUrl, isInCodespaces, ISSUE_OR_URL_EXPRESSION, parseIssueExpressionOutput, vscodeDevPrLink } from './github/utils';
@@ -130,6 +130,14 @@ export async function closeAllPrAndReviewEditors() {
130130
}
131131
}
132132

133+
export function getPullRequestQuickPickItem(pr: PullRequestNumberData): vscode.QuickPickItem & { prNumber: number } {
134+
return {
135+
label: `#${pr.number}`,
136+
description: `${pr.title} by @${pr.author.login}`,
137+
prNumber: pr.number,
138+
};
139+
}
140+
133141
function isCrossChatSessionWithPR(value: any): value is CrossChatSessionWithPR {
134142
const asCrossChatSessionWithPR = value as Partial<CrossChatSessionWithPR>;
135143
return !!asCrossChatSessionWithPR.pullRequestDetails;

src/github/pullRequestQuickPick.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/test/extension.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
16
import { default as assert } from 'assert';
27
import { parseDiffHunk } from '../common/diffHunk';
8+
import { getPullRequestQuickPickItem } from '../commands';
39

410
describe('Extension Tests', function () {
11+
describe('getPullRequestQuickPickItem', () => {
12+
it('separates pull request numbers from titles to prioritize exact number matches', () => {
13+
const item = getPullRequestQuickPickItem({
14+
number: 10063,
15+
title: 'upgrade library to v5',
16+
author: { login: 'octocat' },
17+
});
18+
19+
assert.deepStrictEqual(item, {
20+
label: '#10063',
21+
description: 'upgrade library to v5 by @octocat',
22+
prNumber: 10063,
23+
});
24+
});
25+
});
26+
527
describe('parseDiffHunk', () => {
628
it('should handle empty string', () => {
729
const diffHunk = parseDiffHunk('');

src/test/github/quickPicks.test.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)