From ce0c96820e37b039e055d49f801a3ca7ac19ea40 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 8 Jan 2026 02:45:52 -0800 Subject: [PATCH 1/2] Fix rendering of deny message containing $ Fixes #286120 --- .../commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts b/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts index b7588aa667a..bd48ce8619f 100644 --- a/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts +++ b/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts @@ -211,12 +211,13 @@ export class CommandLineAutoApproveAnalyzer extends Disposable implements IComma isAutoApproveRule(e.rule)) .map(e => { // Session rules cannot be actioned currently so no link + const escapedSourceText = e.rule.sourceText.replace(/\$/g, '\\$'); if (e.rule.sourceTarget === 'session') { - return localize('autoApproveRule.sessionIndicator', '{0} (session)', `\`${e.rule.sourceText}\``); + return localize('autoApproveRule.sessionIndicator', '{0} (session)', `\`${escapedSourceText}\``); } const settingsUri = createCommandUri(TerminalChatCommandId.OpenTerminalSettingsLink, e.rule.sourceTarget); const tooltip = localize('ruleTooltip', 'View rule in settings'); - let label = e.rule.sourceText; + let label = escapedSourceText; switch (e.rule?.sourceTarget) { case ConfigurationTarget.DEFAULT: label = `${label} (default)`; From a8b8823ab5759fe16ab419d5ad3f035edbfaafde Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 8 Jan 2026 03:04:43 -0800 Subject: [PATCH 2/2] Simplify replacing of $ --- .../tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts b/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts index bd48ce8619f..8b81eb8da97 100644 --- a/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts +++ b/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.ts @@ -211,7 +211,7 @@ export class CommandLineAutoApproveAnalyzer extends Disposable implements IComma isAutoApproveRule(e.rule)) .map(e => { // Session rules cannot be actioned currently so no link - const escapedSourceText = e.rule.sourceText.replace(/\$/g, '\\$'); + const escapedSourceText = e.rule.sourceText.replaceAll('$', '\\$'); if (e.rule.sourceTarget === 'session') { return localize('autoApproveRule.sessionIndicator', '{0} (session)', `\`${escapedSourceText}\``); }