Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/chat/browser/chat.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ configurationRegistry.registerConfiguration({
mode: 'auto'
}
},
[ChatConfiguration.RevealNextChangeOnResolve]: {
type: 'boolean',
markdownDescription: nls.localize('chat.editing.revealNextChangeOnResolve', "Controls whether the editor automatically reveals the next change after keeping or undoing a chat edit."),
default: true,
},
'chat.tips.enabled': {
type: 'boolean',
scope: ConfigurationScope.APPLICATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contex
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
import { KeybindingWeight } from '../../../../../platform/keybinding/common/keybindingsRegistry.js';
import { IListService } from '../../../../../platform/list/browser/listService.js';
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';
import { resolveCommandsContext } from '../../../../browser/parts/editor/editorCommandsContext.js';
import { ActiveEditorContext } from '../../../../common/contextkeys.js';
import { EditorResourceAccessor, SideBySideEditor, TEXT_DIFF_EDITOR_ID } from '../../../../common/editor.js';
Expand Down Expand Up @@ -211,14 +212,17 @@ abstract class KeepOrUndoAction extends ChatEditingEditorAction {
override async runChatEditingCommand(accessor: ServicesAccessor, session: IChatEditingSession, entry: IModifiedFileEntry, _integration: IModifiedFileEntryEditorIntegration): Promise<void> {

const instaService = accessor.get(IInstantiationService);
const configService = accessor.get(IConfigurationService);

if (this._keep) {
session.accept(entry.modifiedURI);
} else {
session.reject(entry.modifiedURI);
}

await instaService.invokeFunction(openNextOrPreviousChange, session, entry, true);
if (configService.getValue<boolean>(ChatConfiguration.RevealNextChangeOnResolve)) {
await instaService.invokeFunction(openNextOrPreviousChange, session, entry, true);
}
}
}

Expand Down Expand Up @@ -270,14 +274,15 @@ abstract class AcceptRejectHunkAction extends ChatEditingEditorAction {
override async runChatEditingCommand(accessor: ServicesAccessor, session: IChatEditingSession, entry: IModifiedFileEntry, ctrl: IModifiedFileEntryEditorIntegration, ...args: unknown[]): Promise<void> {

const instaService = accessor.get(IInstantiationService);
const configService = accessor.get(IConfigurationService);

if (this._accept) {
await ctrl.acceptNearestChange(args[0] as IModifiedFileEntryChangeHunk | undefined);
} else {
await ctrl.rejectNearestChange(args[0] as IModifiedFileEntryChangeHunk | undefined);
}

if (entry.changesCount.get() === 0) {
if (configService.getValue<boolean>(ChatConfiguration.RevealNextChangeOnResolve) && entry.changesCount.get() === 0) {
// no more changes, move to next file
await instaService.invokeFunction(openNextOrPreviousChange, session, entry, true);
}
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/chat/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export enum ChatConfiguration {
RestoreLastPanelSession = 'chat.restoreLastPanelSession',
ExitAfterDelegation = 'chat.exitAfterDelegation',
ExplainChangesEnabled = 'chat.editing.explainChanges.enabled',
RevealNextChangeOnResolve = 'chat.editing.revealNextChangeOnResolve',
GrowthNotificationEnabled = 'chat.growthNotification.enabled',
ChatCustomizationMenuEnabled = 'chat.customizationsMenu.enabled',
ChatCustomizationHarnessSelectorEnabled = 'chat.customizations.harnessSelector.enabled',
Expand Down
Loading