-
Notifications
You must be signed in to change notification settings - Fork 705
Fix copy link context menu for issue overview #8414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
alexr00
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to show the vscoddev option for the issues view.
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Removed the vscode.dev option from the issue overview context menu in 9c5a98e. Now only "Copy Link" appears for issues, while PRs still show both options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where the #123 link in the issue overview title wasn't copyable via the right-click context menu. The fix extends the existing pr.copyPrLink command to also work with issues by adding support for the IssueOverview webview and implementing a fallback to resolve issues when pull request resolution fails.
Changes:
- Extended the
pr.copyPrLinkcontext menu command to work in both PullRequestOverview and IssueOverview webviews - Updated the command handler to fall back to
resolveIssuewhenresolvePullRequestreturns undefined - The "Copy vscode.dev Link" option remains PR-only as intended
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| package.json | Added IssueOverview to the webview ID condition for the pr.copyPrLink context menu item |
| src/commands.ts | Refactored command handler to support both PRs and issues by adding fallback logic and updating variable types |
src/commands.ts
Outdated
| context.subscriptions.push( | ||
| vscode.commands.registerCommand('pr.copyPrLink', async (params: OverviewContext | undefined) => { | ||
| let pr: PullRequestModel | undefined; | ||
| let item: PullRequestModel | IssueModel | undefined; |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name item is somewhat generic. Consider using a more descriptive name like prOrIssue or resource to better convey that this can be either a PullRequestModel or an IssueModel. This would improve code readability and make the dual nature of this variable more explicit.
See below for a potential fix:
let prOrIssue: PullRequestModel | IssueModel | undefined;
if (params) {
const folderManager = reposManager.getManagerForRepository(params.owner, params.repo);
prOrIssue = await folderManager?.resolvePullRequest(params.owner, params.repo, params.number, true);
if (!prOrIssue) {
prOrIssue = await folderManager?.resolveIssue(params.owner, params.repo, params.number);
}
}
if (prOrIssue) {
return vscode.env.clipboard.writeText(prOrIssue.html_url);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed the variable from item to prOrIssue in 621e7fb.
Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com>
#123link in the issue overview title is not copyable because context menu items for "Copy Link" are only registered forPullRequestOverviewwebview, notIssueOverviewpackage.jsonto add theIssueOverviewwebview ID to the context menu registration forpr.copyPrLinkonly (notpr.copyVscodeDevPrLink)commands.tsto resolve issues (not just PRs) when copying links forpr.copyPrLinkpr.copyVscodeDevPrLinkas PR-only per review feedbackitemtoprOrIssuefor better readabilityOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.