Skip to content

Commit a9e4501

Browse files
Copilotalexr00
andauthored
Fix copy link context menu for issue overview (#8414)
* Initial plan * Initial plan for issue view copy link fix Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Add IssueOverview webview to copy link context menu registration Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Fix copy link commands to also resolve issues Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Remove vscode.dev link option from issue overview context menu Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 6d38f1d commit a9e4501

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3557,7 +3557,7 @@
35573557
},
35583558
{
35593559
"command": "pr.copyPrLink",
3560-
"when": "webviewId == PullRequestOverview && github:copyMenu"
3560+
"when": "(webviewId == PullRequestOverview || webviewId == IssueOverview) && github:copyMenu"
35613561
},
35623562
{
35633563
"command": "pr.copyVscodeDevPrLink",

src/commands.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,12 +1585,16 @@ ${contents}
15851585

15861586
context.subscriptions.push(
15871587
vscode.commands.registerCommand('pr.copyPrLink', async (params: OverviewContext | undefined) => {
1588-
let pr: PullRequestModel | undefined;
1588+
let item: PullRequestModel | IssueModel | undefined;
15891589
if (params) {
1590-
pr = await reposManager.getManagerForRepository(params.owner, params.repo)?.resolvePullRequest(params.owner, params.repo, params.number, true);
1590+
const folderManager = reposManager.getManagerForRepository(params.owner, params.repo);
1591+
item = await folderManager?.resolvePullRequest(params.owner, params.repo, params.number, true);
1592+
if (!item) {
1593+
item = await folderManager?.resolveIssue(params.owner, params.repo, params.number);
1594+
}
15911595
}
1592-
if (pr) {
1593-
return vscode.env.clipboard.writeText(pr.html_url);
1596+
if (item) {
1597+
return vscode.env.clipboard.writeText(item.html_url);
15941598
}
15951599
}));
15961600

0 commit comments

Comments
 (0)