Skip to content

Commit 4e6e16e

Browse files
authored
add openChatEditedFiles setting (microsoft#256084)
1 parent c8af1f3 commit 4e6e16e

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,11 @@ const configuration: IConfigurationNode = {
802802
'default': true,
803803
'markdownDescription': localize('accessibility.windowTitleOptimized', "Controls whether the {0} should be optimized for screen readers when in screen reader mode. When enabled, the window title will have {1} appended to the end.", '`#window.title#`', '`activeEditorState`')
804804
},
805+
'accessibility.openChatEditedFiles': {
806+
'type': 'boolean',
807+
'default': true,
808+
'markdownDescription': localize('accessibility.openChatEditedFiles', "Controls whether files should be opened when the chat agent has applied edits to them.")
809+
},
805810
}
806811
};
807812

src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export function getAccessibilityHelpText(type: 'panelChat' | 'inlineChat' | 'qui
100100
content.push(localize('chatAgent.runCommand', 'To take the action, use the accept tool command{0}.', '<keybinding:workbench.action.chat.acceptTool>'));
101101
content.push(localize('chatAgent.autoApprove', 'To automatically approve tool actions without manual confirmation, set chat.tools.autoApprove to true in your settings.'));
102102
content.push(localize('chatAgent.acceptTool', 'To accept a tool action, use the Accept Tool Confirmation command{0}.', '<keybinding:workbench.action.chat.acceptTool>'));
103+
content.push(localize('chatAgent.openEditedFilesSetting', 'By default, when edits are made to files, they will be opened. To change this behavior, set accessibility.openChatEditedFiles to false in your settings.'));
103104
}
104105
content.push(localize('chatEditing.helpfulCommands', 'Some helpful commands include:'));
105106
content.push(localize('workbench.action.chat.undoEdits', '- Undo Edits{0}.', '<keybinding:workbench.action.chat.undoEdits>'));

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { URI } from '../../../../../base/common/uri.js';
2121
import { TextEdit } from '../../../../../editor/common/languages.js';
2222
import { ITextModelService } from '../../../../../editor/common/services/resolverService.js';
2323
import { localize } from '../../../../../nls.js';
24+
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';
2425
import { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';
2526
import { IFileService } from '../../../../../platform/files/common/files.js';
2627
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
@@ -74,7 +75,8 @@ export class ChatEditingService extends Disposable implements IChatEditingServic
7475
@ILogService logService: ILogService,
7576
@IExtensionService extensionService: IExtensionService,
7677
@IProductService productService: IProductService,
77-
@INotebookService private readonly notebookService: INotebookService
78+
@INotebookService private readonly notebookService: INotebookService,
79+
@IConfigurationService private readonly _configurationService: IConfigurationService,
7880
) {
7981
super();
8082
this._register(decorationsService.registerDecorationsProvider(_instantiationService.createInstance(ChatDecorationsProvider, this.editingSessionsObs)));
@@ -241,7 +243,9 @@ export class ChatEditingService extends Disposable implements IChatEditingServic
241243
const inactive = editorDidChange
242244
|| this._editorService.activeEditorPane?.input instanceof ChatEditorInput && this._editorService.activeEditorPane.input.sessionId === session.chatSessionId
243245
|| Boolean(activeUri && session.entries.get().find(entry => isEqual(activeUri, entry.modifiedURI)));
244-
this._editorService.openEditor({ resource: uri, options: { inactive, preserveFocus: true, pinned: true } });
246+
if (this._configurationService.getValue('accessibility.openChatEditedFiles')) {
247+
this._editorService.openEditor({ resource: uri, options: { inactive, preserveFocus: true, pinned: true } });
248+
}
245249
}));
246250
};
247251

0 commit comments

Comments
 (0)