Skip to content

Commit d846c0e

Browse files
authored
UI Integration tweaks (#7438)
* UI Integration tweaks * lint
1 parent ab090b8 commit d846c0e

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,14 @@
524524
"experimental"
525525
]
526526
},
527+
"githubPullRequests.codingAgent.promptForConfirmation": {
528+
"type": "boolean",
529+
"default": true,
530+
"markdownDescription": "%githubPullRequests.codingAgent.promptForConfirmation.description%",
531+
"tags": [
532+
"experimental"
533+
]
534+
},
527535
"githubPullRequests.codingAgent.uiIntegration": {
528536
"type": "boolean",
529537
"default": false,

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"githubPullRequests.codingAgent.description": "Enables integration with the asynchronous Copilot coding agent. The '#copilotCodingAgent' tool will be available in agent mode when this setting is enabled.",
2424
"githubPullRequests.codingAgent.uiIntegration.description": "Enables UI integration within VS Code to create new coding agent sessions.",
2525
"githubPullRequests.codingAgent.autoCommitAndPush.description": "Allow automatic git operations (commit, push) to be performed when starting a coding agent session",
26+
"githubPullRequests.codingAgent.promptForConfirmation.description": "Prompt for confirmation before initiating a coding agent session from the UI integration.",
2627
"githubPullRequests.remotes.markdownDescription": "List of remotes, by name, to fetch pull requests from.",
2728
"githubPullRequests.queries.markdownDescription": "Specifies what queries should be used in the GitHub Pull Requests tree. All queries are made against **the currently opened repos**. Each query object has a `label` that will be shown in the tree and a search `query` using [GitHub search syntax](https://help.github.com/en/articles/understanding-the-search-syntax). The following variables can be used: \n - `${user}` will resolve to the currently logged in user \n - `${owner}` will resolve to the owner of the current repository, ex. `microsoft` in `microsoft/vscode` \n - `${repository}` will resolve to the repository name, ex. `vscode` in `microsoft/vscode` \n - `${today-Nd}`, where `N` is the number of days ago, will resolve to a date, ex. `2025-01-04`. \n\n By default these queries define the categories \"Waiting For My Review\", \"Assigned To Me\" and \"Created By Me\". If you want to preserve these, make sure they are still in the array when you modify the setting.",
2829
"githubPullRequests.queries.label.description": "The label to display for the query in the Pull Requests tree",

src/common/settingKeys.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,5 @@ export const COLOR_THEME = 'colorTheme';
8989

9090
export const CODING_AGENT = `${PR_SETTINGS_NAMESPACE}.codingAgent`;
9191
export const CODING_AGENT_ENABLED = 'enabled';
92-
export const CODING_AGENT_AUTO_COMMIT_AND_PUSH = 'autoCommitAndPush';
92+
export const CODING_AGENT_AUTO_COMMIT_AND_PUSH = 'autoCommitAndPush';
93+
export const CODING_AGENT_PROMPT_FOR_CONFIRMATION = 'promptForConfirmation';

src/github/copilotRemoteAgent.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { commands } from '../common/executeCommands';
1212
import { Disposable } from '../common/lifecycle';
1313
import Logger from '../common/logger';
1414
import { GitHubRemote } from '../common/remote';
15-
import { CODING_AGENT, CODING_AGENT_AUTO_COMMIT_AND_PUSH, CODING_AGENT_ENABLED } from '../common/settingKeys';
15+
import { CODING_AGENT, CODING_AGENT_AUTO_COMMIT_AND_PUSH, CODING_AGENT_ENABLED, CODING_AGENT_PROMPT_FOR_CONFIRMATION } from '../common/settingKeys';
1616
import { ITelemetry } from '../common/telemetry';
1717
import { CommentEvent, CopilotFinishedEvent, CopilotStartedEvent, EventType, ReviewEvent, TimelineEvent } from '../common/timelineEvent';
1818
import { DataUri, toOpenPullRequestWebviewUri } from '../common/uri';
@@ -59,6 +59,7 @@ const CONTINUE = vscode.l10n.t('Continue');
5959
// With Pending Changes
6060
const PUSH_CHANGES = vscode.l10n.t('Include changes');
6161
const CONTINUE_WITHOUT_PUSHING = vscode.l10n.t('Ignore changes');
62+
const CONTINUE_AND_DO_NOT_ASK_AGAIN = vscode.l10n.t('Continue and don\'t ask again');
6263
const COMMIT_YOUR_CHANGES = vscode.l10n.t('Commit your changes to continue coding agent session. Close integrated terminal to cancel.');
6364

6465
const COPILOT = '@copilot';
@@ -151,6 +152,11 @@ export class CopilotRemoteAgentManager extends Disposable {
151152
.getConfiguration(CODING_AGENT).get(CODING_AGENT_ENABLED, false);
152153
}
153154

155+
promptForConfirmation(): boolean {
156+
return vscode.workspace
157+
.getConfiguration(CODING_AGENT).get(CODING_AGENT_PROMPT_FOR_CONFIRMATION, true);
158+
}
159+
154160
async isAssignable(): Promise<boolean> {
155161
const repoInfo = await this.repoInfo();
156162
if (!repoInfo) {
@@ -320,7 +326,7 @@ export class CopilotRemoteAgentManager extends Disposable {
320326

321327
let autoPushAndCommit = false;
322328
const message = vscode.l10n.t('Copilot coding agent will continue your work in \'{0}\'.', repoName);
323-
const detail = vscode.l10n.t('Your current chat session will end, and its context will be used to continue your work in a new pull request.');
329+
const detail = vscode.l10n.t('Your chat context will be used to continue work in a new pull request.');
324330
if (source !== 'prompt' && hasChanges && this.autoCommitAndPushEnabled()) {
325331
// Pending changes modal
326332
const modalResult = await vscode.window.showInformationMessage(
@@ -352,7 +358,7 @@ export class CopilotRemoteAgentManager extends Disposable {
352358
if (modalResult === PUSH_CHANGES) {
353359
autoPushAndCommit = true;
354360
}
355-
} else {
361+
} else if (this.promptForConfirmation()) {
356362
// No pending changes modal
357363
const modalResult = await vscode.window.showInformationMessage(
358364
source !== 'prompt' ? message : vscode.l10n.t('Copilot coding agent will implement the specification outlined in this prompt file'),
@@ -361,12 +367,17 @@ export class CopilotRemoteAgentManager extends Disposable {
361367
detail: source !== 'prompt' ? detail : undefined
362368
},
363369
CONTINUE,
370+
CONTINUE_AND_DO_NOT_ASK_AGAIN,
364371
LEARN_MORE,
365372
);
366373
if (!modalResult) {
367374
return;
368375
}
369376

377+
if (modalResult === CONTINUE_AND_DO_NOT_ASK_AGAIN) {
378+
await vscode.workspace.getConfiguration(CODING_AGENT).update(CODING_AGENT_PROMPT_FOR_CONFIRMATION, false, vscode.ConfigurationTarget.Global);
379+
}
380+
370381
if (modalResult === LEARN_MORE) {
371382
learnMoreCb();
372383
return;

0 commit comments

Comments
 (0)