Skip to content

Commit b125c24

Browse files
author
Rachel Macfarlane
committed
Fixes #342, Checking out PR fails when clicking on Description
1 parent 6125882 commit b125c24

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/commands.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { formatError } from './common/utils';
1616
import { GitChangeType } from './common/file';
1717
import { getDiffLineByPosition, getZeroBased } from './common/diffPositionMapping';
1818
import { DiffChangeType } from './common/diffHunk';
19+
import { DescriptionNode } from './view/treeNodes/descriptionNode';
1920

2021
const _onDidClosePR = new vscode.EventEmitter<IPullRequest>();
2122
export const onDidClosePR: vscode.Event<IPullRequest> = _onDidClosePR.event;
@@ -71,10 +72,10 @@ export function registerCommands(context: vscode.ExtensionContext, prManager: IP
7172
}
7273
}));
7374

74-
context.subscriptions.push(vscode.commands.registerCommand('pr.pick', async (pr: PRNode | IPullRequestModel) => {
75-
let pullRequestModel;
75+
context.subscriptions.push(vscode.commands.registerCommand('pr.pick', async (pr: PRNode | DescriptionNode | IPullRequestModel) => {
76+
let pullRequestModel: IPullRequestModel;
7677

77-
if (pr instanceof PRNode) {
78+
if (pr instanceof PRNode || pr instanceof DescriptionNode) {
7879
pullRequestModel = pr.pullRequestModel;
7980
} else {
8081
pullRequestModel = pr;

src/view/treeNodes/descriptionNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ export class DescriptionNode extends TreeNode implements vscode.TreeItem {
1111
public command?: vscode.Command;
1212
public contextValue?: string;
1313

14-
constructor(public label: string, public iconPath: string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri }, public prModel: IPullRequestModel) {
14+
constructor(public label: string, public iconPath: string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri }, public pullRequestModel: IPullRequestModel) {
1515
super();
1616

1717
this.command = {
1818
title: 'View Pull Request Description',
1919
command: 'pr.openDescription',
2020
arguments: [
21-
this.prModel
21+
this.pullRequestModel
2222
]
2323
};
2424

0 commit comments

Comments
 (0)