Skip to content

Commit a30e4b2

Browse files
committed
Document how to unset auto reply, support null explicitly
Fixes #141456
1 parent c89f347 commit a30e4b2

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,23 @@ class RemoteTerminalBackend extends BaseTerminalBackend implements ITerminalBack
103103
// Listen for config changes
104104
const initialConfig = this._configurationService.getValue<ITerminalConfiguration>(TERMINAL_CONFIG_SECTION);
105105
for (const match of Object.keys(initialConfig.autoReplies)) {
106-
this._remoteTerminalChannel.installAutoReply(match, initialConfig.autoReplies[match]);
106+
// Ensure the value is truthy
107+
const reply = initialConfig.autoReplies[match];
108+
if (reply) {
109+
this._remoteTerminalChannel.installAutoReply(match, reply);
110+
}
107111
}
108112
// TODO: Could simplify update to a single call
109113
this._register(this._configurationService.onDidChangeConfiguration(async e => {
110114
if (e.affectsConfiguration(TerminalSettingId.AutoReplies)) {
111115
this._remoteTerminalChannel.uninstallAllAutoReplies();
112116
const config = this._configurationService.getValue<ITerminalConfiguration>(TERMINAL_CONFIG_SECTION);
113117
for (const match of Object.keys(config.autoReplies)) {
114-
await this._remoteTerminalChannel.installAutoReply(match, config.autoReplies[match]);
118+
// Ensure the value is truthy
119+
const reply = config.autoReplies[match];
120+
if (reply) {
121+
await this._remoteTerminalChannel.installAutoReply(match, reply);
122+
}
115123
}
116124
}
117125
}));

src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ const terminalConfiguration: IConfigurationNode = {
505505
default: true
506506
},
507507
[TerminalSettingId.AutoReplies]: {
508-
description: localize('terminal.integrated.autoReplies', "A set of messages that when encountered in the terminal will be automatically responded to. Provided the message is specific enough, this can help automate away common responses. Note that the message includes escape sequences so the reply might not happen with styled text. Each reply can only happen once every second."),
508+
markdownDescription: localize('terminal.integrated.autoReplies', "A set of messages that when encountered in the terminal will be automatically responded to. Provided the message is specific enough, this can help automate away common responses. Note that the message includes escape sequences so the reply might not happen with styled text. Each reply can only happen once every second.\n\nTo unset a default key, set the value to null."),
509509
type: 'object',
510510
additionalProperties: {
511511
type: 'string',

src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,23 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
8787
// Listen for config changes
8888
const initialConfig = configurationService.getValue<ITerminalConfiguration>(TERMINAL_CONFIG_SECTION);
8989
for (const match of Object.keys(initialConfig.autoReplies)) {
90-
this._localPtyService.installAutoReply(match, initialConfig.autoReplies[match]);
90+
// Ensure the reply is value
91+
const reply = initialConfig.autoReplies[match] as string | null;
92+
if (reply) {
93+
this._localPtyService.installAutoReply(match, reply);
94+
}
9195
}
9296
// TODO: Could simplify update to a single call
9397
this._register(configurationService.onDidChangeConfiguration(async e => {
9498
if (e.affectsConfiguration(TerminalSettingId.AutoReplies)) {
9599
this._localPtyService.uninstallAllAutoReplies();
96100
const config = configurationService.getValue<ITerminalConfiguration>(TERMINAL_CONFIG_SECTION);
97101
for (const match of Object.keys(config.autoReplies)) {
98-
await this._localPtyService.installAutoReply(match, config.autoReplies[match]);
102+
// Ensure the reply is value
103+
const reply = config.autoReplies[match] as string | null;
104+
if (reply) {
105+
await this._localPtyService.installAutoReply(match, reply);
106+
}
99107
}
100108
}
101109
}));

0 commit comments

Comments
 (0)