Skip to content

Commit 2a3dea2

Browse files
committed
Support deprecated compatible autoApprove setting temporarily
1 parent a668494 commit 2a3dea2

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,31 @@ export class CommandLineAutoApprover extends Disposable {
2828
super();
2929
this.updateConfiguration();
3030
this._register(this._configurationService.onDidChangeConfiguration(e => {
31-
if (e.affectsConfiguration(TerminalChatAgentToolsSettingId.AutoApprove)) {
31+
if (
32+
e.affectsConfiguration(TerminalChatAgentToolsSettingId.AutoApprove) ||
33+
e.affectsConfiguration(TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible)
34+
) {
3235
this.updateConfiguration();
3336
}
3437
}));
3538
}
3639

3740
updateConfiguration() {
38-
const { denyListRules, allowListRules, allowListCommandLineRules, denyListCommandLineRules } = this._mapAutoApproveConfigToRules(this._configurationService.getValue(TerminalChatAgentToolsSettingId.AutoApprove));
41+
let configValue = this._configurationService.getValue(TerminalChatAgentToolsSettingId.AutoApprove);
42+
const deprecatedValue = this._configurationService.getValue(TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible);
43+
if (deprecatedValue && typeof deprecatedValue === 'object' && configValue && typeof configValue === 'object') {
44+
configValue = {
45+
...configValue,
46+
...deprecatedValue
47+
};
48+
}
49+
50+
const {
51+
denyListRules,
52+
allowListRules,
53+
allowListCommandLineRules,
54+
denyListCommandLineRules
55+
} = this._mapAutoApproveConfigToRules(configValue);
3956
this._allowListRules = allowListRules;
4057
this._denyListRules = denyListRules;
4158
this._allowListCommandLineRules = allowListCommandLineRules;

src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import { ConfigurationScope, type IConfigurationPropertySchema } from '../../../
1111
export const enum TerminalChatAgentToolsSettingId {
1212
AutoApprove = 'chat.tools.terminal.autoApprove',
1313

14+
DeprecatedAutoApproveCompatible = 'chat.agent.terminal.autoApprove',
1415
DeprecatedAutoApprove1 = 'chat.agent.terminal.allowList',
1516
DeprecatedAutoApprove2 = 'chat.agent.terminal.denyList',
1617
DeprecatedAutoApprove3 = 'github.copilot.chat.agent.terminal.allowList',
1718
DeprecatedAutoApprove4 = 'github.copilot.chat.agent.terminal.denyList',
18-
DeprecatedAutoApprove5 = 'chat.agent.terminal.autoApprove',
1919
}
2020

2121
export interface ITerminalChatAgentToolsConfiguration {
@@ -108,7 +108,7 @@ for (const id of [
108108
TerminalChatAgentToolsSettingId.DeprecatedAutoApprove2,
109109
TerminalChatAgentToolsSettingId.DeprecatedAutoApprove3,
110110
TerminalChatAgentToolsSettingId.DeprecatedAutoApprove4,
111-
TerminalChatAgentToolsSettingId.DeprecatedAutoApprove5,
111+
TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible,
112112
]) {
113113
terminalChatAgentToolsConfiguration[id] = {
114114
deprecated: true,

0 commit comments

Comments
 (0)