From 64baba2b0e3bb58363263015722c8e4e98ea3b2e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 16 Jan 2026 21:58:34 +0000 Subject: [PATCH] Add explicit empty code checks in Ruby presenter Co-authored-by: Tyriar <2193314+Tyriar@users.noreply.github.com> --- .../commandLinePresenter/rubyCommandLinePresenter.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.ts b/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.ts index 14f087f85eb0..7f6f078d0705 100644 --- a/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.ts +++ b/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.ts @@ -40,6 +40,11 @@ export function extractRubyCommand(commandLine: string, shell: string, os: Opera if (doubleQuoteMatch?.groups?.code) { let rubyCode = doubleQuoteMatch.groups.code.trim(); + // Return undefined if the trimmed code is empty + if (!rubyCode) { + return undefined; + } + // Unescape quotes based on shell type if (isPowerShell(shell, os)) { // PowerShell uses backtick-quote (`") to escape quotes inside double-quoted strings @@ -57,7 +62,9 @@ export function extractRubyCommand(commandLine: string, shell: string, os: Opera // Single quotes in PowerShell are also literal const singleQuoteMatch = commandLine.match(/^ruby\s+-e\s+'(?.+)'$/s); if (singleQuoteMatch?.groups?.code) { - return singleQuoteMatch.groups.code.trim(); + const rubyCode = singleQuoteMatch.groups.code.trim(); + // Return undefined if the trimmed code is empty + return rubyCode || undefined; } return undefined;