Skip to content

Commit 320f171

Browse files
committed
Merge remote-tracking branch 'origin/main' into copilot/fix-avatar-display-issue
2 parents 207c36b + 0d70e35 commit 320f171

20 files changed

+437
-62
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.122.1
4+
5+
### Fixes
6+
7+
- Only one reviewer can be seen on the PR page. https://github.com/microsoft/vscode-pull-request-github/issues/8131
8+
- Drop down not doing anything. https://github.com/microsoft/vscode-pull-request-github/issues/8149
9+
- Pull in icon fixes. https://github.com/microsoft/vscode-pull-request-github/issues/8159
10+
311
## 0.122.0
412

513
### Changes

package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"enabledApiProposals": [
1414
"activeComment",
15+
"chatContextProvider",
1516
"chatParticipantAdditions",
1617
"chatParticipantPrivate",
1718
"chatSessionsProvider@3",
@@ -42,7 +43,7 @@
4243
"version": "0.122.0",
4344
"publisher": "GitHub",
4445
"engines": {
45-
"vscode": "^1.106.0"
46+
"vscode": "^1.107.0"
4647
},
4748
"categories": [
4849
"Other",
@@ -60,7 +61,9 @@
6061
"onFileSystem:githubcommit",
6162
"onFileSystem:review",
6263
"onWebviewPanel:IssueOverview",
63-
"onWebviewPanel:PullRequestOverview"
64+
"onWebviewPanel:PullRequestOverview",
65+
"onChatContextProvider:githubpr",
66+
"onChatContextProvider:githubissue"
6467
],
6568
"browser": "./dist/browser/extension",
6669
"l10n": "./dist/browser/extension",
@@ -72,6 +75,18 @@
7275
"virtualWorkspaces": true
7376
},
7477
"contributes": {
78+
"chatContext": [
79+
{
80+
"id": "githubpr",
81+
"icon": "$(github)",
82+
"displayName": "GitHub Pull Requests"
83+
},
84+
{
85+
"id": "githubissue",
86+
"icon": "$(issues)",
87+
"displayName": "GitHub Issues"
88+
}
89+
],
7590
"chatSessions": [
7691
{
7792
"type": "copilot-swe-agent",

package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"githubIssues.ignoreMilestones.description": "An array of milestones titles to never show issues from.",
106106
"githubIssues.createIssueTriggers.description": "Strings that will cause the 'Create issue from comment' code action to show.",
107107
"githubIssues.createIssueTriggers.items": "String that enables the 'Create issue from comment' code action. Should not contain whitespace.",
108-
"githubPullRequests.codingAgent.codeLens.description": "Show CodeLens actions above TODO comments for delegating to coding agent.",
108+
"githubPullRequests.codingAgent.codeLens.description": "Show the 'Delegate to agent' CodeLens actions above TODO comments for delegating to coding agent.",
109109
"githubIssues.createInsertFormat.description": "Controls whether an issue number (ex. #1234) or a full url (ex. https://github.com/owner/name/issues/1234) is inserted when the Create Issue code action is run.",
110110
"githubIssues.issueCompletions.enabled.description": "Controls whether completion suggestions are shown for issues.",
111111
"githubIssues.userCompletions.enabled.description": "Controls whether completion suggestions are shown for users.",
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
6+
7+
declare module 'vscode' {
8+
9+
// https://github.com/microsoft/vscode/issues/271104 @alexr00
10+
11+
export namespace chat {
12+
13+
/**
14+
* Register a chat context provider. Chat context can be provided:
15+
* - For a resource. Make sure to pass a selector that matches the resource you want to provide context for.
16+
* Providers registered without a selector will not be called for resource-based context.
17+
* - Explicitly. These context items are shown as options when the user explicitly attaches context.
18+
*
19+
* To ensure your extension is activated when chat context is requested, make sure to include the `onChatContextProvider:<id>` activation event in your `package.json`.
20+
*
21+
* @param selector Optional document selector to filter which resources the provider is called for. If omitted, the provider will only be called for explicit context requests.
22+
* @param id Unique identifier for the provider.
23+
* @param provider The chat context provider.
24+
*/
25+
export function registerChatContextProvider(selector: DocumentSelector | undefined, id: string, provider: ChatContextProvider): Disposable;
26+
27+
}
28+
29+
export interface ChatContextItem {
30+
/**
31+
* Icon for the context item.
32+
*/
33+
icon: ThemeIcon;
34+
/**
35+
* Human readable label for the context item.
36+
*/
37+
label: string;
38+
/**
39+
* An optional description of the context item, e.g. to describe the item to the language model.
40+
*/
41+
modelDescription?: string;
42+
/**
43+
* The value of the context item. Can be omitted when returned from one of the `provide` methods if the provider supports `resolveChatContext`.
44+
*/
45+
value?: string;
46+
}
47+
48+
export interface ChatContextProvider<T extends ChatContextItem = ChatContextItem> {
49+
50+
/**
51+
* An optional event that should be fired when the workspace chat context has changed.
52+
*/
53+
onDidChangeWorkspaceChatContext?: Event<void>;
54+
55+
/**
56+
* Provide a list of chat context items to be included as workspace context for all chat sessions.
57+
*
58+
* @param token A cancellation token.
59+
*/
60+
provideWorkspaceChatContext?(token: CancellationToken): ProviderResult<T[]>;
61+
62+
/**
63+
* Provide a list of chat context items that a user can choose from. These context items are shown as options when the user explicitly attaches context.
64+
* Chat context items can be provided without a `value`, as the `value` can be resolved later using `resolveChatContext`.
65+
* `resolveChatContext` is only called for items that do not have a `value`.
66+
*
67+
* @param token A cancellation token.
68+
*/
69+
provideChatContextExplicit?(token: CancellationToken): ProviderResult<T[]>;
70+
71+
/**
72+
* Given a particular resource, provide a chat context item for it. This is used for implicit context (see the settings `chat.implicitContext.enabled` and `chat.implicitContext.suggestedContext`).
73+
* Chat context items can be provided without a `value`, as the `value` can be resolved later using `resolveChatContext`.
74+
* `resolveChatContext` is only called for items that do not have a `value`.
75+
*
76+
* @param options Options include the resource for which to provide context.
77+
* @param token A cancellation token.
78+
*/
79+
provideChatContextForResource?(options: { resource: Uri }, token: CancellationToken): ProviderResult<T | undefined>;
80+
81+
/**
82+
* If a chat context item is provided without a `value`, from either of the `provide` methods, this method is called to resolve the `value` for the item.
83+
*
84+
* @param context The context item to resolve.
85+
* @param token A cancellation token.
86+
*/
87+
resolveChatContext(context: T, token: CancellationToken): ProviderResult<ChatContextItem>;
88+
}
89+
90+
}

src/common/copilot.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { EventType, TimelineEvent } from './timelineEvent';
77

88
export const COPILOT_SWE_AGENT = 'copilot-swe-agent';
9+
export const COPILOT_CLOUD_AGENT = 'copilot-cloud-agent';
910
export const COPILOT_REVIEWER = 'copilot-pull-request-reviewer';
1011
export const COPILOT_REVIEWER_ID = 'BOT_kgDOCnlnWA';
1112

src/extension.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ import { registerBuiltinGitProvider, registerLiveShareGitProvider } from './gitP
3232
import { GitHubContactServiceProvider } from './gitProviders/GitHubContactServiceProvider';
3333
import { GitLensIntegration } from './integrations/gitlens/gitlensImpl';
3434
import { IssueFeatureRegistrar } from './issues/issueFeatureRegistrar';
35+
import { StateManager } from './issues/stateManager';
36+
import { IssueContextProvider } from './lm/issueContextProvider';
3537
import { ChatParticipant, ChatParticipantState } from './lm/participants';
38+
import { PullRequestContextProvider } from './lm/pullRequestContextProvider';
3639
import { registerTools } from './lm/tools/tools';
3740
import { migrate } from './migrations';
3841
import { NotificationsFeatureRegister } from './notifications/notificationsFeatureRegistar';
@@ -253,10 +256,16 @@ async function init(
253256
const layout = vscode.workspace.getConfiguration(PR_SETTINGS_NAMESPACE).get<string>(FILE_LIST_LAYOUT);
254257
await vscode.commands.executeCommand('setContext', 'fileListLayout:flat', layout === 'flat');
255258

256-
const issuesFeatures = new IssueFeatureRegistrar(git, reposManager, reviewsManager, context, telemetry, copilotRemoteAgentManager);
259+
const issueStateManager = new StateManager(git, reposManager, context);
260+
const issuesFeatures = new IssueFeatureRegistrar(git, reposManager, reviewsManager, context, telemetry, issueStateManager, copilotRemoteAgentManager);
257261
context.subscriptions.push(issuesFeatures);
258262
await issuesFeatures.initialize();
259263

264+
const pullRequestContextProvider = new PullRequestContextProvider(prsTreeModel, reposManager, git);
265+
vscode.chat.registerChatContextProvider({ scheme: 'webview-panel', pattern: '**/webview-PullRequestOverview**' }, 'githubpr', pullRequestContextProvider);
266+
vscode.chat.registerChatContextProvider({ scheme: 'webview-panel', pattern: '**/webview-IssueOverview**' }, 'githubissue', new IssueContextProvider(issueStateManager, reposManager));
267+
pullRequestContextProvider.initialize();
268+
260269
const notificationsFeatures = new NotificationsFeatureRegister(credentialStore, reposManager, telemetry, notificationsManager);
261270
context.subscriptions.push(notificationsFeatures);
262271

src/github/copilotPrWatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export class CopilotPRWatcher extends Disposable {
268268
private async _updateSingleState(pr: PullRequestModel): Promise<void> {
269269
const changes: CodingAgentPRAndStatus[] = [];
270270

271-
const copilotEvents = await pr.getCopilotTimelineEvents(pr, false, !this._model.isInitialized);
271+
const copilotEvents = await pr.getCopilotTimelineEvents(false, !this._model.isInitialized);
272272
let latestEvent = copilotEventToStatus(copilotEvents[copilotEvents.length - 1]);
273273
if (latestEvent === CopilotPRStatus.None) {
274274
if (!COPILOT_ACCOUNTS[pr.author.login]) {

src/github/copilotRemoteAgent.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { parseSessionLogs, parseToolCallDetails, StrReplaceEditorToolData } from
1414
import { GitApiImpl } from '../api/api1';
1515
import { COPILOT_ACCOUNTS } from '../common/comment';
1616
import { CopilotRemoteAgentConfig } from '../common/config';
17-
import { COPILOT_LOGINS, COPILOT_SWE_AGENT } from '../common/copilot';
17+
import { COPILOT_CLOUD_AGENT, COPILOT_LOGINS, COPILOT_SWE_AGENT } from '../common/copilot';
1818
import { commands } from '../common/executeCommands';
1919
import { Disposable } from '../common/lifecycle';
2020
import Logger from '../common/logger';
@@ -45,6 +45,7 @@ const CONTINUE_AND_DO_NOT_ASK_AGAIN = vscode.l10n.t('Continue and don\'t ask aga
4545

4646
const CONTINUE_TRUNCATION = vscode.l10n.t('Continue with truncation');
4747
const DELEGATE_MODAL_DETAILS = vscode.l10n.t('The agent will work asynchronously to create a pull request with your requested changes.');
48+
const DISABLE_CODELENS = vscode.l10n.t('Disable Code Lens');
4849

4950
const COPILOT = '@copilot';
5051

@@ -59,7 +60,7 @@ export namespace SessionIdForPr {
5960

6061
export function getResource(prNumber: number, sessionIndex: number): vscode.Uri {
6162
return vscode.Uri.from({
62-
scheme: COPILOT_SWE_AGENT, path: `/${prefix}-${prNumber}-${sessionIndex}`,
63+
scheme: COPILOT_CLOUD_AGENT, path: `/${prefix}-${prNumber}-${sessionIndex}`,
6364
});
6465
}
6566

@@ -605,16 +606,19 @@ export class CopilotRemoteAgentManager extends Disposable {
605606
const message = vscode.l10n.t('Copilot coding agent will continue your work in \'{0}\'.', repoName);
606607
const detail = DELEGATE_MODAL_DETAILS;
607608
if (source !== 'prompt' && hasChanges && CopilotRemoteAgentConfig.getAutoCommitAndPushEnabled()) {
608-
// Pending changes modal
609+
610+
const buttons = [PUSH_CHANGES, CONTINUE_WITHOUT_PUSHING, LEARN_MORE];
611+
if (source === 'todo') {
612+
buttons.push(DISABLE_CODELENS);
613+
}
614+
609615
const modalResult = await vscode.window.showInformationMessage(
610616
message,
611617
{
612618
modal: true,
613619
detail,
614620
},
615-
PUSH_CHANGES,
616-
CONTINUE_WITHOUT_PUSHING,
617-
LEARN_MORE,
621+
...buttons,
618622
);
619623

620624
if (!modalResult) {
@@ -632,6 +636,11 @@ export class CopilotRemoteAgentManager extends Disposable {
632636
return;
633637
}
634638

639+
if (modalResult === DISABLE_CODELENS) {
640+
vscode.commands.executeCommand('workbench.action.openSettings', 'githubPullRequests.codingAgent.codeLens');
641+
return;
642+
}
643+
635644
if (modalResult === PUSH_CHANGES) {
636645
autoPushAndCommit = true;
637646
}

src/github/folderRepositoryManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ export class FolderRepositoryManager extends Disposable {
24992499
private async promptPullBrach(pr: PullRequestModel, branch: Branch, autoStashSetting?: boolean) {
25002500
if (!this._updateMessageShown || autoStashSetting) {
25012501
// When the PR is from Copilot, we only want to show the notification when Copilot is done working
2502-
const copilotStatus = await pr.copilotWorkingStatus(pr);
2502+
const copilotStatus = await pr.copilotWorkingStatus();
25032503
if (copilotStatus === CopilotWorkingStatus.InProgress) {
25042504
return;
25052505
}

0 commit comments

Comments
 (0)