diff --git a/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts b/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts index 24630e43d3301..76a3859140fed 100644 --- a/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts +++ b/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts @@ -103,7 +103,11 @@ class RemoteTerminalBackend extends BaseTerminalBackend implements ITerminalBack // Listen for config changes const initialConfig = this._configurationService.getValue(TERMINAL_CONFIG_SECTION); for (const match of Object.keys(initialConfig.autoReplies)) { - this._remoteTerminalChannel.installAutoReply(match, initialConfig.autoReplies[match]); + // Ensure the value is truthy + const reply = initialConfig.autoReplies[match]; + if (reply) { + this._remoteTerminalChannel.installAutoReply(match, reply); + } } // TODO: Could simplify update to a single call this._register(this._configurationService.onDidChangeConfiguration(async e => { @@ -111,7 +115,11 @@ class RemoteTerminalBackend extends BaseTerminalBackend implements ITerminalBack this._remoteTerminalChannel.uninstallAllAutoReplies(); const config = this._configurationService.getValue(TERMINAL_CONFIG_SECTION); for (const match of Object.keys(config.autoReplies)) { - await this._remoteTerminalChannel.installAutoReply(match, config.autoReplies[match]); + // Ensure the value is truthy + const reply = config.autoReplies[match]; + if (reply) { + await this._remoteTerminalChannel.installAutoReply(match, reply); + } } } })); diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index dca0fa4173ebc..8c30e02a5b4f4 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -505,7 +505,7 @@ const terminalConfiguration: IConfigurationNode = { default: true }, [TerminalSettingId.AutoReplies]: { - 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."), + 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."), type: 'object', additionalProperties: { type: 'string', diff --git a/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts b/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts index eadc38d5866b3..be0f897041e36 100644 --- a/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts +++ b/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts @@ -87,7 +87,11 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke // Listen for config changes const initialConfig = configurationService.getValue(TERMINAL_CONFIG_SECTION); for (const match of Object.keys(initialConfig.autoReplies)) { - this._localPtyService.installAutoReply(match, initialConfig.autoReplies[match]); + // Ensure the reply is value + const reply = initialConfig.autoReplies[match] as string | null; + if (reply) { + this._localPtyService.installAutoReply(match, reply); + } } // TODO: Could simplify update to a single call this._register(configurationService.onDidChangeConfiguration(async e => { @@ -95,7 +99,11 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke this._localPtyService.uninstallAllAutoReplies(); const config = configurationService.getValue(TERMINAL_CONFIG_SECTION); for (const match of Object.keys(config.autoReplies)) { - await this._localPtyService.installAutoReply(match, config.autoReplies[match]); + // Ensure the reply is value + const reply = config.autoReplies[match] as string | null; + if (reply) { + await this._localPtyService.installAutoReply(match, reply); + } } } }));