Skip to content

Commit ddefd86

Browse files
committed
Merge branch main into copilot/fix-avatar-not-showing
2 parents 02ac83c + ebb1209 commit ddefd86

7 files changed

Lines changed: 62 additions & 27 deletions

File tree

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3100,6 +3100,11 @@
31003100
"command": "pr.unresolveReviewThreadFromView",
31013101
"group": "context@1",
31023102
"when": "commentController =~ /^github-(browse|review)/ && commentThread =~ /canUnresolve/"
3103+
},
3104+
{
3105+
"command": "pr.applySuggestionWithCopilot",
3106+
"group": "context@2",
3107+
"when": "commentController =~ /^github-review/"
31033108
}
31043109
],
31053110
"editor/title": [
@@ -3256,7 +3261,7 @@
32563261
},
32573262
{
32583263
"command": "pr.applySuggestionWithCopilot",
3259-
"when": "commentController =~ /^github-review/ && !(comment =~ /hasSuggestion/)"
3264+
"when": "commentController =~ /^github-review/"
32603265
}
32613266
],
32623267
"comments/comment/title": [
@@ -3268,7 +3273,7 @@
32683273
{
32693274
"command": "pr.applySuggestionWithCopilot",
32703275
"group": "overflow@0",
3271-
"when": "commentController =~ /^github-review/ && !(comment =~ /hasSuggestion/)"
3276+
"when": "commentController =~ /^github-review/"
32723277
},
32733278
{
32743279
"command": "pr.editComment",
@@ -3552,7 +3557,7 @@
35523557
},
35533558
{
35543559
"command": "pr.copyPrLink",
3555-
"when": "webviewId == PullRequestOverview && github:copyMenu"
3560+
"when": "(webviewId == PullRequestOverview || webviewId == IssueOverview) && github:copyMenu"
35563561
},
35573562
{
35583563
"command": "pr.copyVscodeDevPrLink",

src/@types/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ declare module 'vscode' {
171171
pastTenseMessage?: string | MarkdownString;
172172
isConfirmed?: boolean;
173173
isComplete?: boolean;
174-
toolSpecificData?: ChatTerminalToolInvocationData | ChatMcpToolInvocationData;
175-
subAgentInvocationId?: string;
174+
toolSpecificData?: ChatTerminalToolInvocationData;
175+
fromSubAgent?: boolean;
176176
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;
177177

178178
constructor(toolName: string, toolCallId: string, isError?: boolean);
@@ -244,7 +244,7 @@ declare module 'vscode' {
244244
constructor(uris: Uri[], callback: () => Thenable<unknown>);
245245
}
246246

247-
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseWorkspaceEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart;
247+
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart;
248248
export class ChatResponseWarningPart {
249249
value: MarkdownString;
250250
constructor(value: string | MarkdownString);

src/commands.ts

Lines changed: 26 additions & 12 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

@@ -1768,20 +1772,30 @@ ${contents}
17681772
}
17691773
}));
17701774
context.subscriptions.push(
1771-
vscode.commands.registerCommand('pr.applySuggestionWithCopilot', async (comment: GHPRComment) => {
1775+
vscode.commands.registerCommand('pr.applySuggestionWithCopilot', async (comment: GHPRComment | GHPRCommentThread) => {
17721776
/* __GDPR__
17731777
"pr.applySuggestionWithCopilot" : {}
17741778
*/
17751779
telemetry.sendTelemetryEvent('pr.applySuggestionWithCopilot');
17761780

1777-
const commentThread = comment.parent;
1781+
const isThread = GHPRCommentThread.is(comment);
1782+
const commentThread = isThread ? comment : comment.parent;
1783+
const commentBody = isThread ? comment.comments[0].body : comment.body;
17781784
commentThread.collapsibleState = vscode.CommentThreadCollapsibleState.Collapsed;
1779-
const message = comment.body instanceof vscode.MarkdownString ? comment.body.value : comment.body;
1780-
await vscode.commands.executeCommand('vscode.editorChat.start', {
1781-
initialRange: commentThread.range,
1782-
message: message,
1783-
autoSend: true,
1784-
});
1785+
const message = commentBody instanceof vscode.MarkdownString ? commentBody.value : commentBody;
1786+
1787+
if (isThread) {
1788+
// For threads, open the Chat view instead of inline chat
1789+
await vscode.commands.executeCommand(commands.NEW_CHAT, { inputValue: message, isPartialQuery: true, agentMode: true });
1790+
1791+
} else {
1792+
// For single comments, use inline chat
1793+
await vscode.commands.executeCommand('vscode.editorChat.start', {
1794+
initialRange: commentThread.range,
1795+
message: message,
1796+
autoSend: true,
1797+
});
1798+
}
17851799
})
17861800
);
17871801
context.subscriptions.push(

src/issues/issueFeatureRegistrar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ export class IssueFeatureRegistrar extends Disposable {
773773
assignees: template.assignees,
774774
};
775775
}
776-
this.makeNewIssueFile(uri, options);
776+
await this.makeNewIssueFile(uri, options);
777777
}
778778

779779
async createIssueFromFile() {
@@ -1120,7 +1120,7 @@ export class IssueFeatureRegistrar extends Disposable {
11201120
quickInput.busy = true;
11211121
this.createIssueInfo = { document, newIssue, lineNumber, insertIndex };
11221122

1123-
this.makeNewIssueFile(document.uri, { title, body, assignees });
1123+
await this.makeNewIssueFile(document.uri, { title, body, assignees });
11241124
quickInput.busy = false;
11251125
quickInput.hide();
11261126
});

src/view/treeNodes/directoryTreeNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class DirectoryTreeNode extends TreeNode implements vscode.TreeItem {
124124
if (!child.allChildrenViewed()) {
125125
return false;
126126
}
127-
} else if (child.checkboxState.state !== vscode.TreeItemCheckboxState.Checked) {
127+
} else if (!child.checkboxState || child.checkboxState.state !== vscode.TreeItemCheckboxState.Checked) {
128128
return false;
129129
}
130130
}

src/view/treeNodes/fileChangeNode.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
7575
public command: vscode.Command;
7676
public opts: vscode.TextDocumentShowOptions;
7777

78-
public checkboxState: { state: vscode.TreeItemCheckboxState; tooltip?: string; accessibilityInformation: vscode.AccessibilityInformation };
78+
public checkboxState?: { state: vscode.TreeItemCheckboxState; tooltip?: string; accessibilityInformation: vscode.AccessibilityInformation };
7979

8080
get status(): GitChangeType {
8181
return this.changeModel.status;
@@ -155,13 +155,28 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
155155
}
156156
}
157157

158+
/**
159+
* Check if this file node is under a commit node in the tree hierarchy.
160+
* Files under commit nodes should not have checkboxes.
161+
*/
162+
private isUnderCommitNode(): boolean {
163+
// If the file's sha is different from the PR's head sha, it's from an older commit
164+
// and should not have a checkbox
165+
return this.changeModel.sha !== undefined && this.changeModel.sha !== this.pullRequest.head?.sha;
166+
}
167+
158168
updateViewed(viewed: ViewedState) {
159169
this.changeModel.updateViewed(viewed);
160170
this.contextValue = `${Schemes.FileChange}:${GitChangeType[this.changeModel.status]}:${viewed === ViewedState.VIEWED ? 'viewed' : 'unviewed'
161171
}`;
162-
this.checkboxState = viewed === ViewedState.VIEWED ?
163-
{ state: vscode.TreeItemCheckboxState.Checked, tooltip: vscode.l10n.t('Mark File as Unviewed'), accessibilityInformation: { label: vscode.l10n.t('Mark file {0} as unviewed', this.label ?? '') } } :
164-
{ state: vscode.TreeItemCheckboxState.Unchecked, tooltip: vscode.l10n.t('Mark File as Viewed'), accessibilityInformation: { label: vscode.l10n.t('Mark file {0} as viewed', this.label ?? '') } };
172+
// Don't show checkboxes for files under commit nodes
173+
if (!this.isUnderCommitNode()) {
174+
this.checkboxState = viewed === ViewedState.VIEWED ?
175+
{ state: vscode.TreeItemCheckboxState.Checked, tooltip: vscode.l10n.t('Mark File as Unviewed'), accessibilityInformation: { label: vscode.l10n.t('Mark file {0} as unviewed', this.label ?? '') } } :
176+
{ state: vscode.TreeItemCheckboxState.Unchecked, tooltip: vscode.l10n.t('Mark File as Viewed'), accessibilityInformation: { label: vscode.l10n.t('Mark file {0} as viewed', this.label ?? '') } };
177+
} else {
178+
this.checkboxState = undefined;
179+
}
165180
this.pullRequestManager.setFileViewedContext();
166181
}
167182

src/view/treeNodes/treeUtils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ export namespace TreeUtils {
3535
continue;
3636
}
3737
if (!checkedNodes.includes(selected) && !uncheckedNodes.includes(selected)) {
38-
if (selected.checkboxState.state === vscode.TreeItemCheckboxState.Unchecked) {
38+
// Only process files that have checkboxes (files without checkboxState, like those under commits, are skipped)
39+
if (selected.checkboxState?.state === vscode.TreeItemCheckboxState.Unchecked) {
3940
checkedNodes.push(selected);
40-
} else {
41+
} else if (selected.checkboxState?.state === vscode.TreeItemCheckboxState.Checked) {
4142
uncheckedNodes.push(selected);
4243
}
4344
}

0 commit comments

Comments
 (0)