From 0b0c43828433db68a6989b38beb89bac1c8be71a Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Wed, 9 Apr 2025 17:25:12 -0700 Subject: [PATCH 1/8] fix: standardize terminal integration timeout values Replace hardcoded 3000ms timeout with configurable Terminal.shellIntegrationTimeout in TerminalProcess.ts. This ensures consistent timeout behavior across all terminal integration features and allows users to control both timeouts through a single setting. The error messages are also updated to display the dynamic timeout value, providing clearer feedback when shell integration issues occur. Signed-off-by: Eric Wheeler --- src/integrations/terminal/Terminal.ts | 4 ++++ src/integrations/terminal/TerminalProcess.ts | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/integrations/terminal/Terminal.ts b/src/integrations/terminal/Terminal.ts index 340c3427d11..65c51738b14 100644 --- a/src/integrations/terminal/Terminal.ts +++ b/src/integrations/terminal/Terminal.ts @@ -256,6 +256,10 @@ export class Terminal { Terminal.shellIntegrationTimeout = timeoutMs } + public static getShellIntegrationTimeout(): number { + return Terminal.shellIntegrationTimeout + } + public static compressTerminalOutput(input: string, lineLimit: number): string { return truncateOutput(applyRunLengthEncoding(input), lineLimit) } diff --git a/src/integrations/terminal/TerminalProcess.ts b/src/integrations/terminal/TerminalProcess.ts index 21d65577151..cd54ed1ecb2 100644 --- a/src/integrations/terminal/TerminalProcess.ts +++ b/src/integrations/terminal/TerminalProcess.ts @@ -254,12 +254,16 @@ export class TerminalProcess extends EventEmitter { // Emit no_shell_integration event with descriptive message this.emit( "no_shell_integration", - "VSCE shell integration stream did not start within 3 seconds. Terminal problem?", + `VSCE shell integration stream did not start within ${Terminal.getShellIntegrationTimeout() / 1000} seconds. Terminal problem?`, ) // Reject with descriptive error - reject(new Error("VSCE shell integration stream did not start within 3 seconds.")) - }, 3000) + reject( + new Error( + `VSCE shell integration stream did not start within ${Terminal.getShellIntegrationTimeout() / 1000} seconds.`, + ), + ) + }, Terminal.getShellIntegrationTimeout()) // Clean up timeout if stream becomes available this.once("stream_available", (stream: AsyncIterable) => { From 902d6d5017ecc8aa18c8b264856bc1781779c8d9 Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Wed, 9 Apr 2025 20:05:23 -0700 Subject: [PATCH 2/8] fix: prevent UI hang when shell integration is unavailable When shell integration is unavailable, the UI would hang because the process was never properly released. This change fixes the issue by: - Emitting a 'completed' event with a descriptive message - Marking the terminal as not busy - Clearing the active stream - Allowing the process to continue Signed-off-by: Eric Wheeler --- src/integrations/terminal/TerminalProcess.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/integrations/terminal/TerminalProcess.ts b/src/integrations/terminal/TerminalProcess.ts index cd54ed1ecb2..6016279ffb9 100644 --- a/src/integrations/terminal/TerminalProcess.ts +++ b/src/integrations/terminal/TerminalProcess.ts @@ -95,7 +95,6 @@ export interface ExitCodeDetails { coreDumpPossible?: boolean } import { Terminal } from "./Terminal" -import { TerminalRegistry } from "./TerminalRegistry" export interface TerminalProcessEvents { line: [line: string] @@ -140,7 +139,10 @@ export class TerminalProcess extends EventEmitter { this.once("no_shell_integration", () => { if (this.terminalInfo) { console.log(`no_shell_integration received for terminal ${this.terminalInfo.id}`) - TerminalRegistry.removeTerminal(this.terminalInfo.id) + this.emit("completed", "") + this.terminalInfo.busy = false + this.terminalInfo.setActiveStream(undefined) + this.continue() } }) } From 4d1cfe81418819db0ec0472e926e80bbf080115f Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Wed, 9 Apr 2025 20:48:49 -0700 Subject: [PATCH 3/8] feat: add terminal.commandDelay setting Add a new configurable setting to control command execution delays in terminals. When set to a non-zero value, this adds a sleep delay after command execution via PROMPT_COMMAND in bash/zsh and start-sleep in PowerShell. The default value is 0, which disables the delay completely. This setting replaces the previous hardcoded delay of 50ms that was added as a workaround for VSCode bug #237208. Fixes: #2017 Signed-off-by: Eric Wheeler --- src/core/webview/ClineProvider.ts | 6 +++- src/core/webview/webviewMessageHandler.ts | 7 +++++ src/exports/roo-code.d.ts | 1 + src/exports/types.ts | 1 + src/integrations/terminal/Terminal.ts | 17 +++++++++++ src/integrations/terminal/TerminalProcess.ts | 11 +++++-- src/integrations/terminal/TerminalRegistry.ts | 29 +++++++++++-------- .../__tests__/TerminalRegistry.test.ts | 26 ++++++++++++++++- src/schemas/index.ts | 2 ++ src/shared/ExtensionMessage.ts | 1 + src/shared/WebviewMessage.ts | 1 + .../src/components/settings/SettingsView.tsx | 3 ++ .../components/settings/TerminalSettings.tsx | 25 +++++++++++++++- webview-ui/src/i18n/locales/ca/settings.json | 4 +++ webview-ui/src/i18n/locales/de/settings.json | 6 +++- webview-ui/src/i18n/locales/en/settings.json | 4 +++ webview-ui/src/i18n/locales/es/settings.json | 4 +++ webview-ui/src/i18n/locales/fr/settings.json | 4 +++ webview-ui/src/i18n/locales/hi/settings.json | 4 +++ webview-ui/src/i18n/locales/it/settings.json | 4 +++ webview-ui/src/i18n/locales/ja/settings.json | 4 +++ webview-ui/src/i18n/locales/ko/settings.json | 4 +++ webview-ui/src/i18n/locales/pl/settings.json | 4 +++ .../src/i18n/locales/pt-BR/settings.json | 4 +++ webview-ui/src/i18n/locales/tr/settings.json | 4 +++ webview-ui/src/i18n/locales/vi/settings.json | 4 +++ .../src/i18n/locales/zh-CN/settings.json | 4 +++ .../src/i18n/locales/zh-TW/settings.json | 4 +++ 28 files changed, 173 insertions(+), 19 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index df2a45442c3..0bca8c914dc 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -351,9 +351,10 @@ export class ClineProvider extends EventEmitter implements } // Initialize out-of-scope variables that need to recieve persistent global state values - this.getState().then(({ soundEnabled, terminalShellIntegrationTimeout }) => { + this.getState().then(({ soundEnabled, terminalShellIntegrationTimeout, terminalCommandDelay }) => { setSoundEnabled(soundEnabled ?? false) Terminal.setShellIntegrationTimeout(terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT) + Terminal.setCommandDelay(terminalCommandDelay ?? 0) }) // Initialize tts enabled state @@ -1197,6 +1198,7 @@ export class ClineProvider extends EventEmitter implements writeDelayMs, terminalOutputLineLimit, terminalShellIntegrationTimeout, + terminalCommandDelay, fuzzyMatchThreshold, mcpEnabled, enableMcpServerCreation, @@ -1264,6 +1266,7 @@ export class ClineProvider extends EventEmitter implements writeDelayMs: writeDelayMs ?? 1000, terminalOutputLineLimit: terminalOutputLineLimit ?? 500, terminalShellIntegrationTimeout: terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT, + terminalCommandDelay: terminalCommandDelay ?? 0, fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0, mcpEnabled: mcpEnabled ?? true, enableMcpServerCreation: enableMcpServerCreation ?? true, @@ -1350,6 +1353,7 @@ export class ClineProvider extends EventEmitter implements terminalOutputLineLimit: stateValues.terminalOutputLineLimit ?? 500, terminalShellIntegrationTimeout: stateValues.terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT, + terminalCommandDelay: stateValues.terminalCommandDelay ?? 0, mode: stateValues.mode ?? defaultModeSlug, language: stateValues.language ?? formatLanguage(vscode.env.language), mcpEnabled: stateValues.mcpEnabled ?? true, diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 281db62b3fe..9980b3af201 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -736,6 +736,13 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We Terminal.setShellIntegrationTimeout(message.value) } break + case "terminalCommandDelay": + await updateGlobalState("terminalCommandDelay", message.value) + await provider.postStateToWebview() + if (message.value !== undefined) { + Terminal.setCommandDelay(message.value) + } + break case "mode": await provider.handleModeSwitch(message.text as Mode) break diff --git a/src/exports/roo-code.d.ts b/src/exports/roo-code.d.ts index 0efc708928c..b6080cd548c 100644 --- a/src/exports/roo-code.d.ts +++ b/src/exports/roo-code.d.ts @@ -266,6 +266,7 @@ type GlobalSettings = { maxReadFileLine?: number | undefined terminalOutputLineLimit?: number | undefined terminalShellIntegrationTimeout?: number | undefined + terminalCommandDelay?: number | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/exports/types.ts b/src/exports/types.ts index f61be2e04f9..f18c87f5c4c 100644 --- a/src/exports/types.ts +++ b/src/exports/types.ts @@ -269,6 +269,7 @@ type GlobalSettings = { maxReadFileLine?: number | undefined terminalOutputLineLimit?: number | undefined terminalShellIntegrationTimeout?: number | undefined + terminalCommandDelay?: number | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/integrations/terminal/Terminal.ts b/src/integrations/terminal/Terminal.ts index 65c51738b14..d9b6d653b06 100644 --- a/src/integrations/terminal/Terminal.ts +++ b/src/integrations/terminal/Terminal.ts @@ -7,6 +7,7 @@ export const TERMINAL_SHELL_INTEGRATION_TIMEOUT = 5000 export class Terminal { private static shellIntegrationTimeout: number = TERMINAL_SHELL_INTEGRATION_TIMEOUT + private static commandDelay: number = 0 public terminal: vscode.Terminal public busy: boolean @@ -260,6 +261,22 @@ export class Terminal { return Terminal.shellIntegrationTimeout } + /** + * Sets the command delay in milliseconds + * @param delayMs The delay in milliseconds + */ + public static setCommandDelay(delayMs: number): void { + Terminal.commandDelay = delayMs + } + + /** + * Gets the command delay in milliseconds + * @returns The command delay in milliseconds + */ + public static getCommandDelay(): number { + return Terminal.commandDelay + } + public static compressTerminalOutput(input: string, lineLimit: number): string { return truncateOutput(applyRunLengthEncoding(input), lineLimit) } diff --git a/src/integrations/terminal/TerminalProcess.ts b/src/integrations/terminal/TerminalProcess.ts index 6016279ffb9..304ca5bb960 100644 --- a/src/integrations/terminal/TerminalProcess.ts +++ b/src/integrations/terminal/TerminalProcess.ts @@ -290,9 +290,14 @@ export class TerminalProcess extends EventEmitter { (defaultWindowsShellProfile === null || (defaultWindowsShellProfile as string)?.toLowerCase().includes("powershell")) if (isPowerShell) { - terminal.shellIntegration.executeCommand( - `${command} ; "(Roo/PS Workaround: ${this.terminalInfo.cmdCounter++})" > $null; start-sleep -milliseconds 150`, - ) + let commandToExecute = `${command} ; "(Roo/PS Workaround: ${this.terminalInfo.cmdCounter++})" > $null` + + // Only add the sleep command if the command delay is greater than 0 + if (Terminal.getCommandDelay() > 0) { + commandToExecute += `; start-sleep -milliseconds ${Terminal.getCommandDelay()}` + } + + terminal.shellIntegration.executeCommand(commandToExecute) } else { terminal.shellIntegration.executeCommand(command) } diff --git a/src/integrations/terminal/TerminalRegistry.ts b/src/integrations/terminal/TerminalRegistry.ts index dcf1af76d4d..fc21c8c9240 100644 --- a/src/integrations/terminal/TerminalRegistry.ts +++ b/src/integrations/terminal/TerminalRegistry.ts @@ -109,22 +109,27 @@ export class TerminalRegistry { } static createTerminal(cwd: string | vscode.Uri): Terminal { + const env: Record = { + PAGER: "cat", + + // VTE must be disabled because it prevents the prompt command from executing + // See https://wiki.gnome.org/Apps/Terminal/VTE + VTE_VERSION: "0", + } + + // VSCode bug#237208: Command output can be lost due to a race between completion + // sequences and consumers. Add delay via PROMPT_COMMAND to ensure the + // \x1b]633;D escape sequence arrives after command output is processed. + // Only add this if commandDelay is not zero + if (Terminal.getCommandDelay() > 0) { + env.PROMPT_COMMAND = `sleep ${Terminal.getCommandDelay() / 1000}` + } + const terminal = vscode.window.createTerminal({ cwd, name: "Roo Code", iconPath: new vscode.ThemeIcon("rocket"), - env: { - PAGER: "cat", - - // VSCode bug#237208: Command output can be lost due to a race between completion - // sequences and consumers. Add 50ms delay via PROMPT_COMMAND to ensure the - // \x1b]633;D escape sequence arrives after command output is processed. - PROMPT_COMMAND: "sleep 0.050", - - // VTE must be disabled because it prevents the prompt command above from executing - // See https://wiki.gnome.org/Apps/Terminal/VTE - VTE_VERSION: "0", - }, + env, }) const cwdString = cwd.toString() diff --git a/src/integrations/terminal/__tests__/TerminalRegistry.test.ts b/src/integrations/terminal/__tests__/TerminalRegistry.test.ts index a2b8fcd3b08..ed530d5f324 100644 --- a/src/integrations/terminal/__tests__/TerminalRegistry.test.ts +++ b/src/integrations/terminal/__tests__/TerminalRegistry.test.ts @@ -1,5 +1,6 @@ // npx jest src/integrations/terminal/__tests__/TerminalRegistry.test.ts +import { Terminal } from "../Terminal" import { TerminalRegistry } from "../TerminalRegistry" // Mock vscode.window.createTerminal @@ -31,10 +32,33 @@ describe("TerminalRegistry", () => { iconPath: expect.any(Object), env: { PAGER: "cat", - PROMPT_COMMAND: "sleep 0.050", VTE_VERSION: "0", }, }) }) + + it("adds PROMPT_COMMAND when Terminal.getCommandDelay() > 0", () => { + // Set command delay to 50ms for this test + const originalDelay = Terminal.getCommandDelay() + Terminal.setCommandDelay(50) + + try { + TerminalRegistry.createTerminal("/test/path") + + expect(mockCreateTerminal).toHaveBeenCalledWith({ + cwd: "/test/path", + name: "Roo Code", + iconPath: expect.any(Object), + env: { + PAGER: "cat", + PROMPT_COMMAND: "sleep 0.05", + VTE_VERSION: "0", + }, + }) + } finally { + // Restore original delay + Terminal.setCommandDelay(originalDelay) + } + }) }) }) diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 637aaeabe52..8058af4e53a 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -532,6 +532,7 @@ export const globalSettingsSchema = z.object({ terminalOutputLineLimit: z.number().optional(), terminalShellIntegrationTimeout: z.number().optional(), + terminalCommandDelay: z.number().optional(), rateLimitSeconds: z.number().optional(), diffEnabled: z.boolean().optional(), @@ -602,6 +603,7 @@ const globalSettingsRecord: GlobalSettingsRecord = { terminalOutputLineLimit: undefined, terminalShellIntegrationTimeout: undefined, + terminalCommandDelay: undefined, rateLimitSeconds: undefined, diffEnabled: undefined, diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 38277a7c2de..b8b01c8965c 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -153,6 +153,7 @@ export type ExtensionState = Pick< // | "maxReadFileLine" // Optional in GlobalSettings, required here. | "terminalOutputLineLimit" | "terminalShellIntegrationTimeout" + | "terminalCommandDelay" | "diffEnabled" | "fuzzyMatchThreshold" // | "experiments" // Optional in GlobalSettings, required here. diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index 972845959e3..ddb78f85e35 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -82,6 +82,7 @@ export interface WebviewMessage { | "deleteMessage" | "terminalOutputLineLimit" | "terminalShellIntegrationTimeout" + | "terminalCommandDelay" | "mcpEnabled" | "enableMcpServerCreation" | "searchCommits" diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 2411067d778..3e70d7dcf1b 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -129,6 +129,7 @@ const SettingsView = forwardRef(({ onDone, t telemetrySetting, terminalOutputLineLimit, terminalShellIntegrationTimeout, + terminalCommandDelay, writeDelayMs, showRooIgnoredFiles, remoteBrowserEnabled, @@ -237,6 +238,7 @@ const SettingsView = forwardRef(({ onDone, t vscode.postMessage({ type: "screenshotQuality", value: screenshotQuality ?? 75 }) vscode.postMessage({ type: "terminalOutputLineLimit", value: terminalOutputLineLimit ?? 500 }) vscode.postMessage({ type: "terminalShellIntegrationTimeout", value: terminalShellIntegrationTimeout }) + vscode.postMessage({ type: "terminalCommandDelay", value: terminalCommandDelay }) vscode.postMessage({ type: "mcpEnabled", bool: mcpEnabled }) vscode.postMessage({ type: "alwaysApproveResubmit", bool: alwaysApproveResubmit }) vscode.postMessage({ type: "requestDelaySeconds", value: requestDelaySeconds }) @@ -481,6 +483,7 @@ const SettingsView = forwardRef(({ onDone, t diff --git a/webview-ui/src/components/settings/TerminalSettings.tsx b/webview-ui/src/components/settings/TerminalSettings.tsx index 27e4a5b5876..9e777d8322c 100644 --- a/webview-ui/src/components/settings/TerminalSettings.tsx +++ b/webview-ui/src/components/settings/TerminalSettings.tsx @@ -12,12 +12,16 @@ import { Section } from "./Section" type TerminalSettingsProps = HTMLAttributes & { terminalOutputLineLimit?: number terminalShellIntegrationTimeout?: number - setCachedStateField: SetCachedStateField<"terminalOutputLineLimit" | "terminalShellIntegrationTimeout"> + terminalCommandDelay?: number + setCachedStateField: SetCachedStateField< + "terminalOutputLineLimit" | "terminalShellIntegrationTimeout" | "terminalCommandDelay" + > } export const TerminalSettings = ({ terminalOutputLineLimit, terminalShellIntegrationTimeout, + terminalCommandDelay, setCachedStateField, className, ...props @@ -75,6 +79,25 @@ export const TerminalSettings = ({ {t("settings:terminal.shellIntegrationTimeout.description")} + +
+ +
+ + setCachedStateField("terminalCommandDelay", Math.min(1000, Math.max(0, value))) + } + /> + {terminalCommandDelay ?? 50}ms +
+
+ {t("settings:terminal.commandDelay.description")} +
+
) diff --git a/webview-ui/src/i18n/locales/ca/settings.json b/webview-ui/src/i18n/locales/ca/settings.json index c2b62a25265..c185bc89c45 100644 --- a/webview-ui/src/i18n/locales/ca/settings.json +++ b/webview-ui/src/i18n/locales/ca/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "Temps d'espera d'integració de shell del terminal", "description": "Temps màxim d'espera per a la inicialització de la integració de shell abans d'executar comandes. Per a usuaris amb temps d'inici de shell llargs, aquest valor pot necessitar ser augmentat si veieu errors \"Shell Integration Unavailable\" al terminal." + }, + "commandDelay": { + "label": "Retard de comanda del terminal", + "description": "Retard en mil·lisegons a afegir després de l'execució de la comanda. La configuració predeterminada de 0 desactiva completament el retard. Això pot ajudar a assegurar que la sortida de la comanda es capturi completament en terminals amb problemes de temporització. En la majoria de terminals s'implementa establint `PROMPT_COMMAND='sleep N'` i Powershell afegeix `start-sleep` al final de cada comanda. Originalment era una solució per al error VSCode#237208 i pot no ser necessari." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index 9659d0cda7a..98d401da498 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -300,7 +300,11 @@ }, "shellIntegrationTimeout": { "label": "Terminal-Shell-Integrationszeit-Limit", - "description": "Maximale Wartezeit für die Shell-Integration, bevor Befehle ausgeführt werden. Für Benutzer mit langen Shell-Startzeiten muss dieser Wert möglicherweise erhöht werden, wenn Sie Fehler vom Typ \"Shell Integration Unavailable\" im Terminal sehen." + "description": "Maximale Wartezeit für die Shell-Integration, bevor Befehle ausgeführt werden. Für Benutzer mit langen Shell-Startzeiten musst du diesen Wert möglicherweise erhöhen, wenn du Fehler vom Typ \"Shell Integration Unavailable\" im Terminal siehst." + }, + "commandDelay": { + "label": "Terminal-Befehlsverzögerung", + "description": "Verzögerung in Millisekunden, die nach der Befehlsausführung hinzugefügt wird. Die Standardeinstellung von 0 deaktiviert die Verzögerung vollständig. Dies kann dazu beitragen, dass die Befehlsausgabe in Terminals mit Timing-Problemen vollständig erfasst wird. In den meisten Terminals wird dies durch Setzen von `PROMPT_COMMAND='sleep N'` implementiert, und Powershell fügt `start-sleep` am Ende jedes Befehls hinzu. Ursprünglich war dies eine Lösung für VSCode-Bug#237208 und ist möglicherweise nicht mehr erforderlich." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index 8ec853a60c5..e078604e7a8 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "Terminal shell integration timeout", "description": "Maximum time to wait for shell integration to initialize before executing commands. For users with long shell startup times, this value may need to be increased if you see \"Shell Integration Unavailable\" errors in the terminal." + }, + "commandDelay": { + "label": "Terminal command delay", + "description": "Delay in milliseconds to add after command execution. The default setting of 0 disables the delay completely. This can help ensure command output is fully captured in terminals with timing issues. In most terminals it is implemented by setting `PROMPT_COMMAND='sleep N'` and Powershell appends `start-sleep` to the end of each command. Originally was workaround for VSCode bug#237208 and may not be needed." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index e6852a9e8de..7ecabeadb11 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "Tiempo de espera de integración del shell del terminal", "description": "Tiempo máximo de espera para la inicialización de la integración del shell antes de ejecutar comandos. Para usuarios con tiempos de inicio de shell largos, este valor puede necesitar ser aumentado si ve errores \"Shell Integration Unavailable\" en el terminal." + }, + "commandDelay": { + "label": "Retraso de comando del terminal", + "description": "Retraso en milisegundos para añadir después de la ejecución del comando. La configuración predeterminada de 0 desactiva completamente el retraso. Esto puede ayudar a asegurar que la salida del comando se capture completamente en terminales con problemas de temporización. En la mayoría de terminales se implementa estableciendo `PROMPT_COMMAND='sleep N'` y Powershell añade `start-sleep` al final de cada comando. Originalmente era una solución para el error VSCode#237208 y puede no ser necesario." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index 4b77dfa7671..9dec817e3eb 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "Délai d'intégration du shell du terminal", "description": "Temps maximum d'attente pour l'initialisation de l'intégration du shell avant d'exécuter des commandes. Pour les utilisateurs avec des temps de démarrage de shell longs, cette valeur peut nécessiter d'être augmentée si vous voyez des erreurs \"Shell Integration Unavailable\" dans le terminal." + }, + "commandDelay": { + "label": "Délai de commande du terminal", + "description": "Délai en millisecondes à ajouter après l'exécution de la commande. Le paramètre par défaut de 0 désactive complètement le délai. Cela peut aider à garantir que la sortie de la commande est entièrement capturée dans les terminaux avec des problèmes de synchronisation. Dans la plupart des terminaux, cela est implémenté en définissant `PROMPT_COMMAND='sleep N'` et Powershell ajoute `start-sleep` à la fin de chaque commande. À l'origine, c'était une solution pour le bug VSCode#237208 et peut ne pas être nécessaire." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/hi/settings.json b/webview-ui/src/i18n/locales/hi/settings.json index d69b1b9b289..bd579b85176 100644 --- a/webview-ui/src/i18n/locales/hi/settings.json +++ b/webview-ui/src/i18n/locales/hi/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "टर्मिनल शेल एकीकरण टाइमआउट", "description": "कमांड निष्पादित करने से पहले शेल एकीकरण के आरंभ होने के लिए प्रतीक्षा का अधिकतम समय। लंबे शेल स्टार्टअप समय वाले उपयोगकर्ताओं के लिए, यदि आप टर्मिनल में \"Shell Integration Unavailable\" त्रुटियाँ देखते हैं तो इस मान को बढ़ाने की आवश्यकता हो सकती है।" + }, + "commandDelay": { + "label": "टर्मिनल कमांड विलंब", + "description": "कमांड निष्पादन के बाद जोड़ने के लिए मिलीसेकंड में विलंब। 0 का डिफ़ॉल्ट सेटिंग विलंब को पूरी तरह से अक्षम कर देता है। यह टाइमिंग समस्याओं वाले टर्मिनलों में कमांड आउटपुट को पूरी तरह से कैप्चर करने में मदद कर सकता है। अधिकांश टर्मिनलों में यह `PROMPT_COMMAND='sleep N'` सेट करके कार्यान्वित किया जाता है और Powershell प्रत्येक कमांड के अंत में `start-sleep` जोड़ता है। मूल रूप से यह VSCode बग#237208 के लिए एक समाधान था और इसकी आवश्यकता नहीं हो सकती है।" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index 7ce83018ab2..55a434df569 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "Timeout integrazione shell del terminale", "description": "Tempo massimo di attesa per l'inizializzazione dell'integrazione della shell prima di eseguire i comandi. Per gli utenti con tempi di avvio della shell lunghi, questo valore potrebbe dover essere aumentato se si vedono errori \"Shell Integration Unavailable\" nel terminale." + }, + "commandDelay": { + "label": "Ritardo comando terminale", + "description": "Ritardo in millisecondi da aggiungere dopo l'esecuzione del comando. L'impostazione predefinita di 0 disabilita completamente il ritardo. Questo può aiutare a garantire che l'output del comando sia catturato completamente nei terminali con problemi di temporizzazione. Nella maggior parte dei terminali viene implementato impostando `PROMPT_COMMAND='sleep N'` e Powershell aggiunge `start-sleep` alla fine di ogni comando. In origine era una soluzione per il bug VSCode#237208 e potrebbe non essere necessario." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index ede80759f19..7b07c1718d2 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "ターミナルシェル統合タイムアウト", "description": "コマンドを実行する前にシェル統合の初期化を待つ最大時間。シェルの起動時間が長いユーザーの場合、ターミナルで「Shell Integration Unavailable」エラーが表示される場合は、この値を増やす必要があるかもしれません。" + }, + "commandDelay": { + "label": "ターミナルコマンド遅延", + "description": "コマンド実行後に追加する遅延時間(ミリ秒)。デフォルト設定の0は遅延を完全に無効にします。これはタイミングの問題があるターミナルでコマンド出力を完全にキャプチャするのに役立ちます。ほとんどのターミナルでは`PROMPT_COMMAND='sleep N'`を設定することで実装され、PowerShellは各コマンドの最後に`start-sleep`を追加します。元々はVSCodeバグ#237208の回避策で、必要ない場合があります。" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/ko/settings.json b/webview-ui/src/i18n/locales/ko/settings.json index 05717e06f88..59f6db92345 100644 --- a/webview-ui/src/i18n/locales/ko/settings.json +++ b/webview-ui/src/i18n/locales/ko/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "터미널 쉘 통합 타임아웃", "description": "명령을 실행하기 전에 쉘 통합이 초기화될 때까지 기다리는 최대 시간. 쉘 시작 시간이 긴 사용자의 경우, 터미널에서 \"Shell Integration Unavailable\" 오류가 표시되면 이 값을 늘려야 할 수 있습니다." + }, + "commandDelay": { + "label": "터미널 명령 지연", + "description": "명령 실행 후 추가할 지연 시간(밀리초). 기본값 0은 지연을 완전히 비활성화합니다. 이는 타이밍 문제가 있는 터미널에서 명령 출력을 완전히 캡처하는 데 도움이 될 수 있습니다. 대부분의 터미널에서는 `PROMPT_COMMAND='sleep N'`을 설정하여 구현되며, PowerShell은 각 명령 끝에 `start-sleep`을 추가합니다. 원래는 VSCode 버그#237208에 대한 해결책이었으며 필요하지 않을 수 있습니다." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/pl/settings.json b/webview-ui/src/i18n/locales/pl/settings.json index 46c43302a92..df51163a480 100644 --- a/webview-ui/src/i18n/locales/pl/settings.json +++ b/webview-ui/src/i18n/locales/pl/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "Limit czasu integracji powłoki terminala", "description": "Maksymalny czas oczekiwania na inicjalizację integracji powłoki przed wykonaniem poleceń. Dla użytkowników z długim czasem uruchamiania powłoki, ta wartość może wymagać zwiększenia, jeśli widzisz błędy \"Shell Integration Unavailable\" w terminalu." + }, + "commandDelay": { + "label": "Opóźnienie poleceń terminala", + "description": "Opóźnienie w milisekundach dodawane po wykonaniu polecenia. Domyślne ustawienie 0 całkowicie wyłącza opóźnienie. Może to pomóc w zapewnieniu pełnego przechwytywania wyjścia poleceń w terminalach z problemami z synchronizacją. W większości terminali jest to implementowane przez ustawienie `PROMPT_COMMAND='sleep N'`, a PowerShell dodaje `start-sleep` na końcu każdego polecenia. Pierwotnie było to obejście błędu VSCode#237208 i może nie być potrzebne." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index 139f62dece4..3d256d964da 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "Tempo limite de integração do shell do terminal", "description": "Tempo máximo de espera para a inicialização da integração do shell antes de executar comandos. Para usuários com tempos de inicialização de shell longos, este valor pode precisar ser aumentado se você vir erros \"Shell Integration Unavailable\" no terminal." + }, + "commandDelay": { + "label": "Atraso de comando do terminal", + "description": "Atraso em milissegundos para adicionar após a execução do comando. A configuração padrão de 0 desativa completamente o atraso. Isso pode ajudar a garantir que a saída do comando seja totalmente capturada em terminais com problemas de temporização. Na maioria dos terminais, isso é implementado definindo `PROMPT_COMMAND='sleep N'` e o PowerShell adiciona `start-sleep` ao final de cada comando. Originalmente era uma solução para o bug VSCode#237208 e pode não ser necessário." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/tr/settings.json b/webview-ui/src/i18n/locales/tr/settings.json index 01c79fa8aaf..9ae6b7de959 100644 --- a/webview-ui/src/i18n/locales/tr/settings.json +++ b/webview-ui/src/i18n/locales/tr/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "Terminal kabuk entegrasyonu zaman aşımı", "description": "Komutları yürütmeden önce kabuk entegrasyonunun başlatılması için beklenecek maksimum süre. Kabuk başlatma süresi uzun olan kullanıcılar için, terminalde \"Shell Integration Unavailable\" hatalarını görürseniz bu değerin artırılması gerekebilir." + }, + "commandDelay": { + "label": "Terminal komut gecikmesi", + "description": "Komut yürütmesinden sonra eklenecek gecikme süresi (milisaniye). 0 varsayılan ayarı gecikmeyi tamamen devre dışı bırakır. Bu, zamanlama sorunları olan terminallerde komut çıktısının tam olarak yakalanmasını sağlamaya yardımcı olabilir. Çoğu terminalde bu, `PROMPT_COMMAND='sleep N'` ayarlanarak uygulanır ve PowerShell her komutun sonuna `start-sleep` ekler. Başlangıçta VSCode hata#237208 için bir geçici çözümdü ve gerekli olmayabilir." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/vi/settings.json b/webview-ui/src/i18n/locales/vi/settings.json index 04b8de8a324..49929eea6d0 100644 --- a/webview-ui/src/i18n/locales/vi/settings.json +++ b/webview-ui/src/i18n/locales/vi/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "Thời gian chờ tích hợp shell terminal", "description": "Thời gian tối đa để chờ tích hợp shell khởi tạo trước khi thực hiện lệnh. Đối với người dùng có thời gian khởi động shell dài, giá trị này có thể cần được tăng lên nếu bạn thấy lỗi \"Shell Integration Unavailable\" trong terminal." + }, + "commandDelay": { + "label": "Độ trễ lệnh terminal", + "description": "Độ trễ tính bằng mili giây để thêm vào sau khi thực hiện lệnh. Cài đặt mặc định là 0 sẽ tắt hoàn toàn độ trễ. Điều này có thể giúp đảm bảo đầu ra lệnh được ghi lại đầy đủ trong các terminal có vấn đề về thời gian. Trong hầu hết các terminal, điều này được thực hiện bằng cách đặt `PROMPT_COMMAND='sleep N'` và PowerShell thêm `start-sleep` vào cuối mỗi lệnh. Ban đầu là giải pháp cho lỗi VSCode#237208 và có thể không cần thiết." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index 3a99b9d790f..2c76312c48c 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "终端初始化等待时间", "description": "执行命令前等待 Shell 集成初始化的最长时间。对于 Shell 启动时间较长的用户,如果在终端中看到\"Shell Integration Unavailable\"错误,可能需要增加此值。" + }, + "commandDelay": { + "label": "终端命令延迟", + "description": "命令执行后添加的延迟时间(毫秒)。默认设置为 0 时完全禁用延迟。这可以帮助确保在有计时问题的终端中完全捕获命令输出。在大多数终端中,这是通过设置 `PROMPT_COMMAND='sleep N'` 实现的,而 PowerShell 会在每个命令末尾添加 `start-sleep`。最初是为了解决 VSCode 错误#237208,现在可能不再需要。" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/zh-TW/settings.json b/webview-ui/src/i18n/locales/zh-TW/settings.json index 2e6a3383a43..51b56e7be6d 100644 --- a/webview-ui/src/i18n/locales/zh-TW/settings.json +++ b/webview-ui/src/i18n/locales/zh-TW/settings.json @@ -301,6 +301,10 @@ "shellIntegrationTimeout": { "label": "終端機 Shell 整合逾時", "description": "執行命令前等待 Shell 整合初始化的最長時間。如果您的 Shell 啟動較慢,且終端機出現「Shell 整合無法使用」的錯誤訊息,可能需要提高此數值。" + }, + "commandDelay": { + "label": "終端機命令延遲", + "description": "命令執行後添加的延遲時間(毫秒)。預設值為 0 時完全停用延遲。這可以幫助確保在有計時問題的終端機中完整擷取命令輸出。在大多數終端機中,這是透過設定 `PROMPT_COMMAND='sleep N'` 實現的,而 PowerShell 會在每個命令結尾加入 `start-sleep`。最初是為了解決 VSCode 錯誤#237208,現在可能不再需要。" } }, "advanced": { From 211e31b8f6db42396afb96300c898511437a785f Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Wed, 9 Apr 2025 21:50:33 -0700 Subject: [PATCH 4/8] feat: add terminalPowershellCounter configuration option Add a new configuration option that allows users to toggle the PowerShell counter workaround. This workaround adds a counter to PowerShell commands to ensure proper command execution and output capture. The setting is disabled by default, allowing users to enable it only when needed. Signed-off-by: Eric Wheeler --- src/core/webview/ClineProvider.ts | 3 +++ src/core/webview/webviewMessageHandler.ts | 7 +++++++ src/exports/roo-code.d.ts | 1 + src/exports/types.ts | 1 + src/integrations/terminal/Terminal.ts | 17 ++++++++++++++++ src/integrations/terminal/TerminalProcess.ts | 9 +++++++-- src/schemas/index.ts | 2 ++ src/shared/ExtensionMessage.ts | 1 + src/shared/WebviewMessage.ts | 1 + .../src/components/settings/SettingsView.tsx | 3 +++ .../components/settings/TerminalSettings.tsx | 20 ++++++++++++++++++- webview-ui/src/i18n/locales/ca/settings.json | 4 ++++ webview-ui/src/i18n/locales/de/settings.json | 4 ++++ webview-ui/src/i18n/locales/en/settings.json | 4 ++++ webview-ui/src/i18n/locales/es/settings.json | 4 ++++ webview-ui/src/i18n/locales/fr/settings.json | 4 ++++ webview-ui/src/i18n/locales/hi/settings.json | 4 ++++ webview-ui/src/i18n/locales/it/settings.json | 4 ++++ webview-ui/src/i18n/locales/ja/settings.json | 4 ++++ webview-ui/src/i18n/locales/ko/settings.json | 4 ++++ webview-ui/src/i18n/locales/pl/settings.json | 4 ++++ .../src/i18n/locales/pt-BR/settings.json | 4 ++++ webview-ui/src/i18n/locales/tr/settings.json | 4 ++++ webview-ui/src/i18n/locales/vi/settings.json | 4 ++++ .../src/i18n/locales/zh-CN/settings.json | 4 ++++ .../src/i18n/locales/zh-TW/settings.json | 4 ++++ 26 files changed, 122 insertions(+), 3 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 0bca8c914dc..eab37313803 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1199,6 +1199,7 @@ export class ClineProvider extends EventEmitter implements terminalOutputLineLimit, terminalShellIntegrationTimeout, terminalCommandDelay, + terminalPowershellCounter, fuzzyMatchThreshold, mcpEnabled, enableMcpServerCreation, @@ -1267,6 +1268,7 @@ export class ClineProvider extends EventEmitter implements terminalOutputLineLimit: terminalOutputLineLimit ?? 500, terminalShellIntegrationTimeout: terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT, terminalCommandDelay: terminalCommandDelay ?? 0, + terminalPowershellCounter: terminalPowershellCounter ?? false, fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0, mcpEnabled: mcpEnabled ?? true, enableMcpServerCreation: enableMcpServerCreation ?? true, @@ -1354,6 +1356,7 @@ export class ClineProvider extends EventEmitter implements terminalShellIntegrationTimeout: stateValues.terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT, terminalCommandDelay: stateValues.terminalCommandDelay ?? 0, + terminalPowershellCounter: stateValues.terminalPowershellCounter ?? false, mode: stateValues.mode ?? defaultModeSlug, language: stateValues.language ?? formatLanguage(vscode.env.language), mcpEnabled: stateValues.mcpEnabled ?? true, diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 9980b3af201..9a630eb8b53 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -743,6 +743,13 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We Terminal.setCommandDelay(message.value) } break + case "terminalPowershellCounter": + await updateGlobalState("terminalPowershellCounter", message.bool) + await provider.postStateToWebview() + if (message.bool !== undefined) { + Terminal.setPowershellCounter(message.bool) + } + break case "mode": await provider.handleModeSwitch(message.text as Mode) break diff --git a/src/exports/roo-code.d.ts b/src/exports/roo-code.d.ts index b6080cd548c..e0627840f81 100644 --- a/src/exports/roo-code.d.ts +++ b/src/exports/roo-code.d.ts @@ -267,6 +267,7 @@ type GlobalSettings = { terminalOutputLineLimit?: number | undefined terminalShellIntegrationTimeout?: number | undefined terminalCommandDelay?: number | undefined + terminalPowershellCounter?: boolean | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/exports/types.ts b/src/exports/types.ts index f18c87f5c4c..061ddf3aabf 100644 --- a/src/exports/types.ts +++ b/src/exports/types.ts @@ -270,6 +270,7 @@ type GlobalSettings = { terminalOutputLineLimit?: number | undefined terminalShellIntegrationTimeout?: number | undefined terminalCommandDelay?: number | undefined + terminalPowershellCounter?: boolean | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/integrations/terminal/Terminal.ts b/src/integrations/terminal/Terminal.ts index d9b6d653b06..a0b14976ca7 100644 --- a/src/integrations/terminal/Terminal.ts +++ b/src/integrations/terminal/Terminal.ts @@ -8,6 +8,7 @@ export const TERMINAL_SHELL_INTEGRATION_TIMEOUT = 5000 export class Terminal { private static shellIntegrationTimeout: number = TERMINAL_SHELL_INTEGRATION_TIMEOUT private static commandDelay: number = 0 + private static powershellCounter: boolean = false public terminal: vscode.Terminal public busy: boolean @@ -277,6 +278,22 @@ export class Terminal { return Terminal.commandDelay } + /** + * Sets whether to use the PowerShell counter workaround + * @param enabled Whether to enable the PowerShell counter workaround + */ + public static setPowershellCounter(enabled: boolean): void { + Terminal.powershellCounter = enabled + } + + /** + * Gets whether to use the PowerShell counter workaround + * @returns Whether the PowerShell counter workaround is enabled + */ + public static getPowershellCounter(): boolean { + return Terminal.powershellCounter + } + public static compressTerminalOutput(input: string, lineLimit: number): string { return truncateOutput(applyRunLengthEncoding(input), lineLimit) } diff --git a/src/integrations/terminal/TerminalProcess.ts b/src/integrations/terminal/TerminalProcess.ts index 304ca5bb960..a84db00ef30 100644 --- a/src/integrations/terminal/TerminalProcess.ts +++ b/src/integrations/terminal/TerminalProcess.ts @@ -290,11 +290,16 @@ export class TerminalProcess extends EventEmitter { (defaultWindowsShellProfile === null || (defaultWindowsShellProfile as string)?.toLowerCase().includes("powershell")) if (isPowerShell) { - let commandToExecute = `${command} ; "(Roo/PS Workaround: ${this.terminalInfo.cmdCounter++})" > $null` + let commandToExecute = command + + // Only add the PowerShell counter workaround if enabled + if (Terminal.getPowershellCounter()) { + commandToExecute += ` ; "(Roo/PS Workaround: ${this.terminalInfo.cmdCounter++})" > $null` + } // Only add the sleep command if the command delay is greater than 0 if (Terminal.getCommandDelay() > 0) { - commandToExecute += `; start-sleep -milliseconds ${Terminal.getCommandDelay()}` + commandToExecute += ` ; start-sleep -milliseconds ${Terminal.getCommandDelay()}` } terminal.shellIntegration.executeCommand(commandToExecute) diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 8058af4e53a..5e80b346530 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -533,6 +533,7 @@ export const globalSettingsSchema = z.object({ terminalOutputLineLimit: z.number().optional(), terminalShellIntegrationTimeout: z.number().optional(), terminalCommandDelay: z.number().optional(), + terminalPowershellCounter: z.boolean().optional(), rateLimitSeconds: z.number().optional(), diffEnabled: z.boolean().optional(), @@ -604,6 +605,7 @@ const globalSettingsRecord: GlobalSettingsRecord = { terminalOutputLineLimit: undefined, terminalShellIntegrationTimeout: undefined, terminalCommandDelay: undefined, + terminalPowershellCounter: undefined, rateLimitSeconds: undefined, diffEnabled: undefined, diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index b8b01c8965c..fe8a1f5a254 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -154,6 +154,7 @@ export type ExtensionState = Pick< | "terminalOutputLineLimit" | "terminalShellIntegrationTimeout" | "terminalCommandDelay" + | "terminalPowershellCounter" | "diffEnabled" | "fuzzyMatchThreshold" // | "experiments" // Optional in GlobalSettings, required here. diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index ddb78f85e35..122b6c78b04 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -83,6 +83,7 @@ export interface WebviewMessage { | "terminalOutputLineLimit" | "terminalShellIntegrationTimeout" | "terminalCommandDelay" + | "terminalPowershellCounter" | "mcpEnabled" | "enableMcpServerCreation" | "searchCommits" diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 3e70d7dcf1b..c21b5d2c00f 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -130,6 +130,7 @@ const SettingsView = forwardRef(({ onDone, t terminalOutputLineLimit, terminalShellIntegrationTimeout, terminalCommandDelay, + terminalPowershellCounter, writeDelayMs, showRooIgnoredFiles, remoteBrowserEnabled, @@ -239,6 +240,7 @@ const SettingsView = forwardRef(({ onDone, t vscode.postMessage({ type: "terminalOutputLineLimit", value: terminalOutputLineLimit ?? 500 }) vscode.postMessage({ type: "terminalShellIntegrationTimeout", value: terminalShellIntegrationTimeout }) vscode.postMessage({ type: "terminalCommandDelay", value: terminalCommandDelay }) + vscode.postMessage({ type: "terminalPowershellCounter", bool: terminalPowershellCounter }) vscode.postMessage({ type: "mcpEnabled", bool: mcpEnabled }) vscode.postMessage({ type: "alwaysApproveResubmit", bool: alwaysApproveResubmit }) vscode.postMessage({ type: "requestDelaySeconds", value: requestDelaySeconds }) @@ -484,6 +486,7 @@ const SettingsView = forwardRef(({ onDone, t terminalOutputLineLimit={terminalOutputLineLimit} terminalShellIntegrationTimeout={terminalShellIntegrationTimeout} terminalCommandDelay={terminalCommandDelay} + terminalPowershellCounter={terminalPowershellCounter} setCachedStateField={setCachedStateField} /> diff --git a/webview-ui/src/components/settings/TerminalSettings.tsx b/webview-ui/src/components/settings/TerminalSettings.tsx index 9e777d8322c..7029549366e 100644 --- a/webview-ui/src/components/settings/TerminalSettings.tsx +++ b/webview-ui/src/components/settings/TerminalSettings.tsx @@ -1,6 +1,7 @@ import { HTMLAttributes } from "react" import { useAppTranslation } from "@/i18n/TranslationContext" import { SquareTerminal } from "lucide-react" +import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" import { cn } from "@/lib/utils" import { Slider } from "@/components/ui" @@ -13,8 +14,12 @@ type TerminalSettingsProps = HTMLAttributes & { terminalOutputLineLimit?: number terminalShellIntegrationTimeout?: number terminalCommandDelay?: number + terminalPowershellCounter?: boolean setCachedStateField: SetCachedStateField< - "terminalOutputLineLimit" | "terminalShellIntegrationTimeout" | "terminalCommandDelay" + | "terminalOutputLineLimit" + | "terminalShellIntegrationTimeout" + | "terminalCommandDelay" + | "terminalPowershellCounter" > } @@ -22,6 +27,7 @@ export const TerminalSettings = ({ terminalOutputLineLimit, terminalShellIntegrationTimeout, terminalCommandDelay, + terminalPowershellCounter, setCachedStateField, className, ...props @@ -98,6 +104,18 @@ export const TerminalSettings = ({ {t("settings:terminal.commandDelay.description")} + +
+ setCachedStateField("terminalPowershellCounter", e.target.checked)} + data-testid="terminal-powershell-counter-checkbox"> + {t("settings:terminal.powershellCounter.label")} + +
+ {t("settings:terminal.powershellCounter.description")} +
+
) diff --git a/webview-ui/src/i18n/locales/ca/settings.json b/webview-ui/src/i18n/locales/ca/settings.json index c185bc89c45..8b0e617abee 100644 --- a/webview-ui/src/i18n/locales/ca/settings.json +++ b/webview-ui/src/i18n/locales/ca/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Retard de comanda del terminal", "description": "Retard en mil·lisegons a afegir després de l'execució de la comanda. La configuració predeterminada de 0 desactiva completament el retard. Això pot ajudar a assegurar que la sortida de la comanda es capturi completament en terminals amb problemes de temporització. En la majoria de terminals s'implementa establint `PROMPT_COMMAND='sleep N'` i Powershell afegeix `start-sleep` al final de cada comanda. Originalment era una solució per al error VSCode#237208 i pot no ser necessari." + }, + "powershellCounter": { + "label": "Habilita la solució temporal del comptador PowerShell", + "description": "Quan està habilitat, afegeix un comptador a les comandes PowerShell per assegurar l'execució correcta de les comandes. Això ajuda amb els terminals PowerShell que poden tenir problemes amb la captura de sortida." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index 98d401da498..ba37047aefa 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Terminal-Befehlsverzögerung", "description": "Verzögerung in Millisekunden, die nach der Befehlsausführung hinzugefügt wird. Die Standardeinstellung von 0 deaktiviert die Verzögerung vollständig. Dies kann dazu beitragen, dass die Befehlsausgabe in Terminals mit Timing-Problemen vollständig erfasst wird. In den meisten Terminals wird dies durch Setzen von `PROMPT_COMMAND='sleep N'` implementiert, und Powershell fügt `start-sleep` am Ende jedes Befehls hinzu. Ursprünglich war dies eine Lösung für VSCode-Bug#237208 und ist möglicherweise nicht mehr erforderlich." + }, + "powershellCounter": { + "label": "PowerShell-Zähler-Workaround aktivieren", + "description": "Wenn aktiviert, fügt einen Zähler zu PowerShell-Befehlen hinzu, um die korrekte Befehlsausführung sicherzustellen. Dies hilft bei PowerShell-Terminals, die Probleme mit der Ausgabeerfassung haben könnten." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index e078604e7a8..129e6826dbd 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Terminal command delay", "description": "Delay in milliseconds to add after command execution. The default setting of 0 disables the delay completely. This can help ensure command output is fully captured in terminals with timing issues. In most terminals it is implemented by setting `PROMPT_COMMAND='sleep N'` and Powershell appends `start-sleep` to the end of each command. Originally was workaround for VSCode bug#237208 and may not be needed." + }, + "powershellCounter": { + "label": "Enable PowerShell counter workaround", + "description": "When enabled, adds a counter to PowerShell commands to ensure proper command execution. This helps with PowerShell terminals that might have issues with command output capture." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index 7ecabeadb11..fe8b5ad1f8d 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Retraso de comando del terminal", "description": "Retraso en milisegundos para añadir después de la ejecución del comando. La configuración predeterminada de 0 desactiva completamente el retraso. Esto puede ayudar a asegurar que la salida del comando se capture completamente en terminales con problemas de temporización. En la mayoría de terminales se implementa estableciendo `PROMPT_COMMAND='sleep N'` y Powershell añade `start-sleep` al final de cada comando. Originalmente era una solución para el error VSCode#237208 y puede no ser necesario." + }, + "powershellCounter": { + "label": "Habilitar solución temporal del contador de PowerShell", + "description": "Cuando está habilitado, agrega un contador a los comandos de PowerShell para garantizar la ejecución correcta de los comandos. Esto ayuda con las terminales PowerShell que pueden tener problemas con la captura de salida de comandos." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index 9dec817e3eb..f4fa875ba3c 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Délai de commande du terminal", "description": "Délai en millisecondes à ajouter après l'exécution de la commande. Le paramètre par défaut de 0 désactive complètement le délai. Cela peut aider à garantir que la sortie de la commande est entièrement capturée dans les terminaux avec des problèmes de synchronisation. Dans la plupart des terminaux, cela est implémenté en définissant `PROMPT_COMMAND='sleep N'` et Powershell ajoute `start-sleep` à la fin de chaque commande. À l'origine, c'était une solution pour le bug VSCode#237208 et peut ne pas être nécessaire." + }, + "powershellCounter": { + "label": "Activer le contournement du compteur PowerShell", + "description": "Lorsqu'activé, ajoute un compteur aux commandes PowerShell pour assurer une exécution correcte des commandes. Cela aide avec les terminaux PowerShell qui peuvent avoir des problèmes de capture de sortie." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/hi/settings.json b/webview-ui/src/i18n/locales/hi/settings.json index bd579b85176..0c421d71989 100644 --- a/webview-ui/src/i18n/locales/hi/settings.json +++ b/webview-ui/src/i18n/locales/hi/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "टर्मिनल कमांड विलंब", "description": "कमांड निष्पादन के बाद जोड़ने के लिए मिलीसेकंड में विलंब। 0 का डिफ़ॉल्ट सेटिंग विलंब को पूरी तरह से अक्षम कर देता है। यह टाइमिंग समस्याओं वाले टर्मिनलों में कमांड आउटपुट को पूरी तरह से कैप्चर करने में मदद कर सकता है। अधिकांश टर्मिनलों में यह `PROMPT_COMMAND='sleep N'` सेट करके कार्यान्वित किया जाता है और Powershell प्रत्येक कमांड के अंत में `start-sleep` जोड़ता है। मूल रूप से यह VSCode बग#237208 के लिए एक समाधान था और इसकी आवश्यकता नहीं हो सकती है।" + }, + "powershellCounter": { + "label": "PowerShell काउंटर समाधान सक्षम करें", + "description": "सक्षम होने पर, कमांड के सही निष्पादन को सुनिश्चित करने के लिए PowerShell कमांड में एक काउंटर जोड़ता है। यह उन PowerShell टर्मिनलों के साथ मदद करता है जिनमें आउटपुट कैप्चर करने में समस्याएं हो सकती हैं।" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index 55a434df569..25ce585bb04 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Ritardo comando terminale", "description": "Ritardo in millisecondi da aggiungere dopo l'esecuzione del comando. L'impostazione predefinita di 0 disabilita completamente il ritardo. Questo può aiutare a garantire che l'output del comando sia catturato completamente nei terminali con problemi di temporizzazione. Nella maggior parte dei terminali viene implementato impostando `PROMPT_COMMAND='sleep N'` e Powershell aggiunge `start-sleep` alla fine di ogni comando. In origine era una soluzione per il bug VSCode#237208 e potrebbe non essere necessario." + }, + "powershellCounter": { + "label": "Abilita soluzione temporanea contatore PowerShell", + "description": "Quando abilitato, aggiunge un contatore ai comandi PowerShell per garantire la corretta esecuzione dei comandi. Questo aiuta con i terminali PowerShell che potrebbero avere problemi con la cattura dell'output." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index 7b07c1718d2..21fa39ed039 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "ターミナルコマンド遅延", "description": "コマンド実行後に追加する遅延時間(ミリ秒)。デフォルト設定の0は遅延を完全に無効にします。これはタイミングの問題があるターミナルでコマンド出力を完全にキャプチャするのに役立ちます。ほとんどのターミナルでは`PROMPT_COMMAND='sleep N'`を設定することで実装され、PowerShellは各コマンドの最後に`start-sleep`を追加します。元々はVSCodeバグ#237208の回避策で、必要ない場合があります。" + }, + "powershellCounter": { + "label": "PowerShellカウンター回避策を有効化", + "description": "有効にすると、PowerShellコマンドにカウンターを追加して、コマンドの正しい実行を確保します。これは出力のキャプチャに問題がある可能性のあるPowerShellターミナルで役立ちます。" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/ko/settings.json b/webview-ui/src/i18n/locales/ko/settings.json index 59f6db92345..ca1fe0c66b2 100644 --- a/webview-ui/src/i18n/locales/ko/settings.json +++ b/webview-ui/src/i18n/locales/ko/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "터미널 명령 지연", "description": "명령 실행 후 추가할 지연 시간(밀리초). 기본값 0은 지연을 완전히 비활성화합니다. 이는 타이밍 문제가 있는 터미널에서 명령 출력을 완전히 캡처하는 데 도움이 될 수 있습니다. 대부분의 터미널에서는 `PROMPT_COMMAND='sleep N'`을 설정하여 구현되며, PowerShell은 각 명령 끝에 `start-sleep`을 추가합니다. 원래는 VSCode 버그#237208에 대한 해결책이었으며 필요하지 않을 수 있습니다." + }, + "powershellCounter": { + "label": "PowerShell 카운터 해결 방법 활성화", + "description": "활성화하면 PowerShell 명령에 카운터를 추가하여 명령이 올바르게 실행되도록 합니다. 이는 명령 출력 캡처에 문제가 있을 수 있는 PowerShell 터미널에서 도움이 됩니다." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/pl/settings.json b/webview-ui/src/i18n/locales/pl/settings.json index df51163a480..6f3e553de2e 100644 --- a/webview-ui/src/i18n/locales/pl/settings.json +++ b/webview-ui/src/i18n/locales/pl/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Opóźnienie poleceń terminala", "description": "Opóźnienie w milisekundach dodawane po wykonaniu polecenia. Domyślne ustawienie 0 całkowicie wyłącza opóźnienie. Może to pomóc w zapewnieniu pełnego przechwytywania wyjścia poleceń w terminalach z problemami z synchronizacją. W większości terminali jest to implementowane przez ustawienie `PROMPT_COMMAND='sleep N'`, a PowerShell dodaje `start-sleep` na końcu każdego polecenia. Pierwotnie było to obejście błędu VSCode#237208 i może nie być potrzebne." + }, + "powershellCounter": { + "label": "Włącz obejście licznika PowerShell", + "description": "Po włączeniu dodaje licznik do poleceń PowerShell, aby zapewnić prawidłowe wykonanie poleceń. Pomaga to w terminalach PowerShell, które mogą mieć problemy z przechwytywaniem wyjścia." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index 3d256d964da..a1a9e04c035 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Atraso de comando do terminal", "description": "Atraso em milissegundos para adicionar após a execução do comando. A configuração padrão de 0 desativa completamente o atraso. Isso pode ajudar a garantir que a saída do comando seja totalmente capturada em terminais com problemas de temporização. Na maioria dos terminais, isso é implementado definindo `PROMPT_COMMAND='sleep N'` e o PowerShell adiciona `start-sleep` ao final de cada comando. Originalmente era uma solução para o bug VSCode#237208 e pode não ser necessário." + }, + "powershellCounter": { + "label": "Ativar solução alternativa do contador PowerShell", + "description": "Quando ativado, adiciona um contador aos comandos PowerShell para garantir a execução correta dos comandos. Isso ajuda com terminais PowerShell que podem ter problemas com a captura de saída." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/tr/settings.json b/webview-ui/src/i18n/locales/tr/settings.json index 9ae6b7de959..9d9aff5ae60 100644 --- a/webview-ui/src/i18n/locales/tr/settings.json +++ b/webview-ui/src/i18n/locales/tr/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Terminal komut gecikmesi", "description": "Komut yürütmesinden sonra eklenecek gecikme süresi (milisaniye). 0 varsayılan ayarı gecikmeyi tamamen devre dışı bırakır. Bu, zamanlama sorunları olan terminallerde komut çıktısının tam olarak yakalanmasını sağlamaya yardımcı olabilir. Çoğu terminalde bu, `PROMPT_COMMAND='sleep N'` ayarlanarak uygulanır ve PowerShell her komutun sonuna `start-sleep` ekler. Başlangıçta VSCode hata#237208 için bir geçici çözümdü ve gerekli olmayabilir." + }, + "powershellCounter": { + "label": "PowerShell sayaç geçici çözümünü etkinleştir", + "description": "Etkinleştirildiğinde, komutların doğru şekilde yürütülmesini sağlamak için PowerShell komutlarına bir sayaç ekler. Bu, çıktı yakalama sorunları yaşayabilecek PowerShell terminallerinde yardımcı olur." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/vi/settings.json b/webview-ui/src/i18n/locales/vi/settings.json index 49929eea6d0..1fd61d9e53c 100644 --- a/webview-ui/src/i18n/locales/vi/settings.json +++ b/webview-ui/src/i18n/locales/vi/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "Độ trễ lệnh terminal", "description": "Độ trễ tính bằng mili giây để thêm vào sau khi thực hiện lệnh. Cài đặt mặc định là 0 sẽ tắt hoàn toàn độ trễ. Điều này có thể giúp đảm bảo đầu ra lệnh được ghi lại đầy đủ trong các terminal có vấn đề về thời gian. Trong hầu hết các terminal, điều này được thực hiện bằng cách đặt `PROMPT_COMMAND='sleep N'` và PowerShell thêm `start-sleep` vào cuối mỗi lệnh. Ban đầu là giải pháp cho lỗi VSCode#237208 và có thể không cần thiết." + }, + "powershellCounter": { + "label": "Bật giải pháp bộ đếm PowerShell", + "description": "Khi được bật, thêm một bộ đếm vào các lệnh PowerShell để đảm bảo thực thi lệnh chính xác. Điều này giúp ích với các terminal PowerShell có thể gặp vấn đề về ghi lại đầu ra." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index 2c76312c48c..fb36e431b5a 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "终端命令延迟", "description": "命令执行后添加的延迟时间(毫秒)。默认设置为 0 时完全禁用延迟。这可以帮助确保在有计时问题的终端中完全捕获命令输出。在大多数终端中,这是通过设置 `PROMPT_COMMAND='sleep N'` 实现的,而 PowerShell 会在每个命令末尾添加 `start-sleep`。最初是为了解决 VSCode 错误#237208,现在可能不再需要。" + }, + "powershellCounter": { + "label": "启用 PowerShell 计数器解决方案", + "description": "启用后,会在 PowerShell 命令中添加计数器以确保命令正确执行。这有助于解决可能存在输出捕获问题的 PowerShell 终端。" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/zh-TW/settings.json b/webview-ui/src/i18n/locales/zh-TW/settings.json index 51b56e7be6d..6a600695f4c 100644 --- a/webview-ui/src/i18n/locales/zh-TW/settings.json +++ b/webview-ui/src/i18n/locales/zh-TW/settings.json @@ -305,6 +305,10 @@ "commandDelay": { "label": "終端機命令延遲", "description": "命令執行後添加的延遲時間(毫秒)。預設值為 0 時完全停用延遲。這可以幫助確保在有計時問題的終端機中完整擷取命令輸出。在大多數終端機中,這是透過設定 `PROMPT_COMMAND='sleep N'` 實現的,而 PowerShell 會在每個命令結尾加入 `start-sleep`。最初是為了解決 VSCode 錯誤#237208,現在可能不再需要。" + }, + "powershellCounter": { + "label": "啟用 PowerShell 計數器解決方案", + "description": "啟用後,會在 PowerShell 命令中加入計數器以確保命令正確執行。這有助於解決可能存在輸出擷取問題的 PowerShell 終端機。" } }, "advanced": { From b020e4607674b9315cd03722e6c1e0cb8b6e95b9 Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Wed, 9 Apr 2025 22:12:14 -0700 Subject: [PATCH 5/8] fix: clear ZSH EOL mark to prevent command output interpretation issues Added a new configuration option 'terminalZshClearEolMark' (default: true) that sets PROMPT_EOL_MARK='' in the terminal environment. This prevents issues with command output interpretation when the output ends with special characters like '%'. Added translations for all supported languages. Fixes: #2194 Signed-off-by: Eric Wheeler --- src/core/webview/ClineProvider.ts | 25 +++++++++++++++---- src/core/webview/webviewMessageHandler.ts | 7 ++++++ src/exports/roo-code.d.ts | 1 + src/exports/types.ts | 1 + src/integrations/terminal/Terminal.ts | 17 +++++++++++++ src/integrations/terminal/TerminalRegistry.ts | 6 +++++ .../__tests__/TerminalRegistry.test.ts | 2 ++ src/schemas/index.ts | 2 ++ src/shared/ExtensionMessage.ts | 1 + src/shared/WebviewMessage.ts | 1 + .../src/components/settings/SettingsView.tsx | 3 +++ .../components/settings/TerminalSettings.tsx | 15 +++++++++++ webview-ui/src/i18n/locales/ca/settings.json | 4 +++ webview-ui/src/i18n/locales/de/settings.json | 4 +++ webview-ui/src/i18n/locales/en/settings.json | 4 +++ webview-ui/src/i18n/locales/es/settings.json | 4 +++ webview-ui/src/i18n/locales/fr/settings.json | 4 +++ webview-ui/src/i18n/locales/hi/settings.json | 4 +++ webview-ui/src/i18n/locales/it/settings.json | 4 +++ webview-ui/src/i18n/locales/ja/settings.json | 4 +++ webview-ui/src/i18n/locales/ko/settings.json | 4 +++ webview-ui/src/i18n/locales/pl/settings.json | 4 +++ .../src/i18n/locales/pt-BR/settings.json | 4 +++ webview-ui/src/i18n/locales/tr/settings.json | 4 +++ webview-ui/src/i18n/locales/vi/settings.json | 4 +++ .../src/i18n/locales/zh-CN/settings.json | 4 +++ .../src/i18n/locales/zh-TW/settings.json | 4 +++ 27 files changed, 136 insertions(+), 5 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index eab37313803..f87c23ff15f 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -351,11 +351,23 @@ export class ClineProvider extends EventEmitter implements } // Initialize out-of-scope variables that need to recieve persistent global state values - this.getState().then(({ soundEnabled, terminalShellIntegrationTimeout, terminalCommandDelay }) => { - setSoundEnabled(soundEnabled ?? false) - Terminal.setShellIntegrationTimeout(terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT) - Terminal.setCommandDelay(terminalCommandDelay ?? 0) - }) + this.getState().then( + ({ + soundEnabled, + terminalShellIntegrationTimeout, + terminalCommandDelay, + terminalZshClearEolMark, + terminalPowershellCounter, + }) => { + setSoundEnabled(soundEnabled ?? false) + Terminal.setShellIntegrationTimeout( + terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT, + ) + Terminal.setCommandDelay(terminalCommandDelay ?? 0) + Terminal.setTerminalZshClearEolMark(terminalZshClearEolMark ?? true) + Terminal.setPowershellCounter(terminalPowershellCounter ?? false) + }, + ) // Initialize tts enabled state this.getState().then(({ ttsEnabled }) => { @@ -1200,6 +1212,7 @@ export class ClineProvider extends EventEmitter implements terminalShellIntegrationTimeout, terminalCommandDelay, terminalPowershellCounter, + terminalZshClearEolMark, fuzzyMatchThreshold, mcpEnabled, enableMcpServerCreation, @@ -1269,6 +1282,7 @@ export class ClineProvider extends EventEmitter implements terminalShellIntegrationTimeout: terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT, terminalCommandDelay: terminalCommandDelay ?? 0, terminalPowershellCounter: terminalPowershellCounter ?? false, + terminalZshClearEolMark: terminalZshClearEolMark ?? true, fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0, mcpEnabled: mcpEnabled ?? true, enableMcpServerCreation: enableMcpServerCreation ?? true, @@ -1357,6 +1371,7 @@ export class ClineProvider extends EventEmitter implements stateValues.terminalShellIntegrationTimeout ?? TERMINAL_SHELL_INTEGRATION_TIMEOUT, terminalCommandDelay: stateValues.terminalCommandDelay ?? 0, terminalPowershellCounter: stateValues.terminalPowershellCounter ?? false, + terminalZshClearEolMark: stateValues.terminalZshClearEolMark ?? true, mode: stateValues.mode ?? defaultModeSlug, language: stateValues.language ?? formatLanguage(vscode.env.language), mcpEnabled: stateValues.mcpEnabled ?? true, diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 9a630eb8b53..3a02e0f9370 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -750,6 +750,13 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We Terminal.setPowershellCounter(message.bool) } break + case "terminalZshClearEolMark": + await updateGlobalState("terminalZshClearEolMark", message.bool) + await provider.postStateToWebview() + if (message.bool !== undefined) { + Terminal.setTerminalZshClearEolMark(message.bool) + } + break case "mode": await provider.handleModeSwitch(message.text as Mode) break diff --git a/src/exports/roo-code.d.ts b/src/exports/roo-code.d.ts index e0627840f81..0aba68638c2 100644 --- a/src/exports/roo-code.d.ts +++ b/src/exports/roo-code.d.ts @@ -268,6 +268,7 @@ type GlobalSettings = { terminalShellIntegrationTimeout?: number | undefined terminalCommandDelay?: number | undefined terminalPowershellCounter?: boolean | undefined + terminalZshClearEolMark?: boolean | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/exports/types.ts b/src/exports/types.ts index 061ddf3aabf..9a53ecdc7c8 100644 --- a/src/exports/types.ts +++ b/src/exports/types.ts @@ -271,6 +271,7 @@ type GlobalSettings = { terminalShellIntegrationTimeout?: number | undefined terminalCommandDelay?: number | undefined terminalPowershellCounter?: boolean | undefined + terminalZshClearEolMark?: boolean | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/integrations/terminal/Terminal.ts b/src/integrations/terminal/Terminal.ts index a0b14976ca7..ed6dfd62bf3 100644 --- a/src/integrations/terminal/Terminal.ts +++ b/src/integrations/terminal/Terminal.ts @@ -9,6 +9,7 @@ export class Terminal { private static shellIntegrationTimeout: number = TERMINAL_SHELL_INTEGRATION_TIMEOUT private static commandDelay: number = 0 private static powershellCounter: boolean = false + private static terminalZshClearEolMark: boolean = true public terminal: vscode.Terminal public busy: boolean @@ -294,6 +295,22 @@ export class Terminal { return Terminal.powershellCounter } + /** + * Sets whether to clear the ZSH EOL mark + * @param enabled Whether to clear the ZSH EOL mark + */ + public static setTerminalZshClearEolMark(enabled: boolean): void { + Terminal.terminalZshClearEolMark = enabled + } + + /** + * Gets whether to clear the ZSH EOL mark + * @returns Whether the ZSH EOL mark clearing is enabled + */ + public static getTerminalZshClearEolMark(): boolean { + return Terminal.terminalZshClearEolMark + } + public static compressTerminalOutput(input: string, lineLimit: number): string { return truncateOutput(applyRunLengthEncoding(input), lineLimit) } diff --git a/src/integrations/terminal/TerminalRegistry.ts b/src/integrations/terminal/TerminalRegistry.ts index fc21c8c9240..8dcf375225d 100644 --- a/src/integrations/terminal/TerminalRegistry.ts +++ b/src/integrations/terminal/TerminalRegistry.ts @@ -125,6 +125,12 @@ export class TerminalRegistry { env.PROMPT_COMMAND = `sleep ${Terminal.getCommandDelay() / 1000}` } + // Clear the ZSH EOL mark to prevent issues with command output interpretation + // when output ends with special characters like '%' + if (Terminal.getTerminalZshClearEolMark()) { + env.PROMPT_EOL_MARK = "" + } + const terminal = vscode.window.createTerminal({ cwd, name: "Roo Code", diff --git a/src/integrations/terminal/__tests__/TerminalRegistry.test.ts b/src/integrations/terminal/__tests__/TerminalRegistry.test.ts index ed530d5f324..5b9d42f92dd 100644 --- a/src/integrations/terminal/__tests__/TerminalRegistry.test.ts +++ b/src/integrations/terminal/__tests__/TerminalRegistry.test.ts @@ -33,6 +33,7 @@ describe("TerminalRegistry", () => { env: { PAGER: "cat", VTE_VERSION: "0", + PROMPT_EOL_MARK: "", }, }) }) @@ -53,6 +54,7 @@ describe("TerminalRegistry", () => { PAGER: "cat", PROMPT_COMMAND: "sleep 0.05", VTE_VERSION: "0", + PROMPT_EOL_MARK: "", }, }) } finally { diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 5e80b346530..9f7d78be361 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -534,6 +534,7 @@ export const globalSettingsSchema = z.object({ terminalShellIntegrationTimeout: z.number().optional(), terminalCommandDelay: z.number().optional(), terminalPowershellCounter: z.boolean().optional(), + terminalZshClearEolMark: z.boolean().optional(), rateLimitSeconds: z.number().optional(), diffEnabled: z.boolean().optional(), @@ -606,6 +607,7 @@ const globalSettingsRecord: GlobalSettingsRecord = { terminalShellIntegrationTimeout: undefined, terminalCommandDelay: undefined, terminalPowershellCounter: undefined, + terminalZshClearEolMark: undefined, rateLimitSeconds: undefined, diffEnabled: undefined, diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index fe8a1f5a254..6e00f7e3b44 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -155,6 +155,7 @@ export type ExtensionState = Pick< | "terminalShellIntegrationTimeout" | "terminalCommandDelay" | "terminalPowershellCounter" + | "terminalZshClearEolMark" | "diffEnabled" | "fuzzyMatchThreshold" // | "experiments" // Optional in GlobalSettings, required here. diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index 122b6c78b04..3fd74b99c54 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -84,6 +84,7 @@ export interface WebviewMessage { | "terminalShellIntegrationTimeout" | "terminalCommandDelay" | "terminalPowershellCounter" + | "terminalZshClearEolMark" | "mcpEnabled" | "enableMcpServerCreation" | "searchCommits" diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index c21b5d2c00f..8384f2208e9 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -131,6 +131,7 @@ const SettingsView = forwardRef(({ onDone, t terminalShellIntegrationTimeout, terminalCommandDelay, terminalPowershellCounter, + terminalZshClearEolMark, writeDelayMs, showRooIgnoredFiles, remoteBrowserEnabled, @@ -241,6 +242,7 @@ const SettingsView = forwardRef(({ onDone, t vscode.postMessage({ type: "terminalShellIntegrationTimeout", value: terminalShellIntegrationTimeout }) vscode.postMessage({ type: "terminalCommandDelay", value: terminalCommandDelay }) vscode.postMessage({ type: "terminalPowershellCounter", bool: terminalPowershellCounter }) + vscode.postMessage({ type: "terminalZshClearEolMark", bool: terminalZshClearEolMark }) vscode.postMessage({ type: "mcpEnabled", bool: mcpEnabled }) vscode.postMessage({ type: "alwaysApproveResubmit", bool: alwaysApproveResubmit }) vscode.postMessage({ type: "requestDelaySeconds", value: requestDelaySeconds }) @@ -487,6 +489,7 @@ const SettingsView = forwardRef(({ onDone, t terminalShellIntegrationTimeout={terminalShellIntegrationTimeout} terminalCommandDelay={terminalCommandDelay} terminalPowershellCounter={terminalPowershellCounter} + terminalZshClearEolMark={terminalZshClearEolMark} setCachedStateField={setCachedStateField} /> diff --git a/webview-ui/src/components/settings/TerminalSettings.tsx b/webview-ui/src/components/settings/TerminalSettings.tsx index 7029549366e..613725d65b3 100644 --- a/webview-ui/src/components/settings/TerminalSettings.tsx +++ b/webview-ui/src/components/settings/TerminalSettings.tsx @@ -15,11 +15,13 @@ type TerminalSettingsProps = HTMLAttributes & { terminalShellIntegrationTimeout?: number terminalCommandDelay?: number terminalPowershellCounter?: boolean + terminalZshClearEolMark?: boolean setCachedStateField: SetCachedStateField< | "terminalOutputLineLimit" | "terminalShellIntegrationTimeout" | "terminalCommandDelay" | "terminalPowershellCounter" + | "terminalZshClearEolMark" > } @@ -28,6 +30,7 @@ export const TerminalSettings = ({ terminalShellIntegrationTimeout, terminalCommandDelay, terminalPowershellCounter, + terminalZshClearEolMark, setCachedStateField, className, ...props @@ -116,6 +119,18 @@ export const TerminalSettings = ({ {t("settings:terminal.powershellCounter.description")} + +
+ setCachedStateField("terminalZshClearEolMark", e.target.checked)} + data-testid="terminal-zsh-clear-eol-mark-checkbox"> + {t("settings:terminal.zshClearEolMark.label")} + +
+ {t("settings:terminal.zshClearEolMark.description")} +
+
) diff --git a/webview-ui/src/i18n/locales/ca/settings.json b/webview-ui/src/i18n/locales/ca/settings.json index 8b0e617abee..42510a36878 100644 --- a/webview-ui/src/i18n/locales/ca/settings.json +++ b/webview-ui/src/i18n/locales/ca/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "Habilita la solució temporal del comptador PowerShell", "description": "Quan està habilitat, afegeix un comptador a les comandes PowerShell per assegurar l'execució correcta de les comandes. Això ajuda amb els terminals PowerShell que poden tenir problemes amb la captura de sortida." + }, + "zshClearEolMark": { + "label": "Neteja la marca EOL de ZSH", + "description": "Quan està habilitat, neteja la marca de final de línia de ZSH establint PROMPT_EOL_MARK=''. Això evita problemes amb la interpretació de la sortida de comandes quan acaba amb caràcters especials com '%'." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index ba37047aefa..ce960f966de 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "PowerShell-Zähler-Workaround aktivieren", "description": "Wenn aktiviert, fügt einen Zähler zu PowerShell-Befehlen hinzu, um die korrekte Befehlsausführung sicherzustellen. Dies hilft bei PowerShell-Terminals, die Probleme mit der Ausgabeerfassung haben könnten." + }, + "zshClearEolMark": { + "label": "ZSH-Zeilenende-Markierung löschen", + "description": "Wenn aktiviert, wird die ZSH-Zeilenende-Markierung durch Setzen von PROMPT_EOL_MARK='' gelöscht. Dies verhindert Probleme bei der Interpretation der Befehlsausgabe, wenn diese mit Sonderzeichen wie '%' endet." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index 129e6826dbd..fdb846156c0 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "Enable PowerShell counter workaround", "description": "When enabled, adds a counter to PowerShell commands to ensure proper command execution. This helps with PowerShell terminals that might have issues with command output capture." + }, + "zshClearEolMark": { + "label": "Clear ZSH EOL mark", + "description": "When enabled, clears the ZSH end-of-line mark by setting PROMPT_EOL_MARK=''. This prevents issues with command output interpretation when output ends with special characters like '%'." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index fe8b5ad1f8d..5fac4e5a418 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "Habilitar solución temporal del contador de PowerShell", "description": "Cuando está habilitado, agrega un contador a los comandos de PowerShell para garantizar la ejecución correcta de los comandos. Esto ayuda con las terminales PowerShell que pueden tener problemas con la captura de salida de comandos." + }, + "zshClearEolMark": { + "label": "Limpiar marca de fin de línea de ZSH", + "description": "Cuando está habilitado, limpia la marca de fin de línea de ZSH estableciendo PROMPT_EOL_MARK=''. Esto evita problemas con la interpretación de la salida de comandos cuando termina con caracteres especiales como '%'." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index f4fa875ba3c..f98c9406638 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "Activer le contournement du compteur PowerShell", "description": "Lorsqu'activé, ajoute un compteur aux commandes PowerShell pour assurer une exécution correcte des commandes. Cela aide avec les terminaux PowerShell qui peuvent avoir des problèmes de capture de sortie." + }, + "zshClearEolMark": { + "label": "Effacer la marque de fin de ligne ZSH", + "description": "Lorsqu'activé, efface la marque de fin de ligne ZSH en définissant PROMPT_EOL_MARK=''. Cela évite les problèmes d'interprétation de la sortie des commandes lorsqu'elle se termine par des caractères spéciaux comme '%'." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/hi/settings.json b/webview-ui/src/i18n/locales/hi/settings.json index 0c421d71989..dc1f1b2712c 100644 --- a/webview-ui/src/i18n/locales/hi/settings.json +++ b/webview-ui/src/i18n/locales/hi/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "PowerShell काउंटर समाधान सक्षम करें", "description": "सक्षम होने पर, कमांड के सही निष्पादन को सुनिश्चित करने के लिए PowerShell कमांड में एक काउंटर जोड़ता है। यह उन PowerShell टर्मिनलों के साथ मदद करता है जिनमें आउटपुट कैप्चर करने में समस्याएं हो सकती हैं।" + }, + "zshClearEolMark": { + "label": "ZSH EOL मार्क साफ़ करें", + "description": "सक्षम होने पर, PROMPT_EOL_MARK='' सेट करके ZSH लाइन-समाप्ति मार्क को साफ़ करता है। यह कमांड आउटपुट की व्याख्या में समस्याओं को रोकता है जब आउटपुट '%' जैसे विशेष वर्णों के साथ समाप्त होता है।" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index 25ce585bb04..69fe311b86a 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "Abilita soluzione temporanea contatore PowerShell", "description": "Quando abilitato, aggiunge un contatore ai comandi PowerShell per garantire la corretta esecuzione dei comandi. Questo aiuta con i terminali PowerShell che potrebbero avere problemi con la cattura dell'output." + }, + "zshClearEolMark": { + "label": "Cancella marcatore fine riga ZSH", + "description": "Quando abilitato, cancella il marcatore di fine riga ZSH impostando PROMPT_EOL_MARK=''. Questo previene problemi con l'interpretazione dell'output dei comandi quando termina con caratteri speciali come '%'." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index 21fa39ed039..7c76d7afd75 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "PowerShellカウンター回避策を有効化", "description": "有効にすると、PowerShellコマンドにカウンターを追加して、コマンドの正しい実行を確保します。これは出力のキャプチャに問題がある可能性のあるPowerShellターミナルで役立ちます。" + }, + "zshClearEolMark": { + "label": "ZSH行末マークをクリア", + "description": "有効にすると、PROMPT_EOL_MARK=''を設定してZSHの行末マークをクリアします。これにより、'%'などの特殊文字で終わるコマンド出力の解釈に関する問題を防ぎます。" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/ko/settings.json b/webview-ui/src/i18n/locales/ko/settings.json index ca1fe0c66b2..9d1ec745f29 100644 --- a/webview-ui/src/i18n/locales/ko/settings.json +++ b/webview-ui/src/i18n/locales/ko/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "PowerShell 카운터 해결 방법 활성화", "description": "활성화하면 PowerShell 명령에 카운터를 추가하여 명령이 올바르게 실행되도록 합니다. 이는 명령 출력 캡처에 문제가 있을 수 있는 PowerShell 터미널에서 도움이 됩니다." + }, + "zshClearEolMark": { + "label": "ZSH 줄 끝 표시 지우기", + "description": "활성화하면 PROMPT_EOL_MARK=''를 설정하여 ZSH 줄 끝 표시를 지웁니다. 이는 '%'와 같은 특수 문자로 끝나는 명령 출력 해석의 문제를 방지합니다." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/pl/settings.json b/webview-ui/src/i18n/locales/pl/settings.json index 6f3e553de2e..1ec0b3d7fdf 100644 --- a/webview-ui/src/i18n/locales/pl/settings.json +++ b/webview-ui/src/i18n/locales/pl/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "Włącz obejście licznika PowerShell", "description": "Po włączeniu dodaje licznik do poleceń PowerShell, aby zapewnić prawidłowe wykonanie poleceń. Pomaga to w terminalach PowerShell, które mogą mieć problemy z przechwytywaniem wyjścia." + }, + "zshClearEolMark": { + "label": "Wyczyść znacznik końca linii ZSH", + "description": "Po włączeniu czyści znacznik końca linii ZSH poprzez ustawienie PROMPT_EOL_MARK=''. Zapobiega to problemom z interpretacją wyjścia poleceń, gdy kończy się ono znakami specjalnymi jak '%'." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index a1a9e04c035..f9670b1edcc 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "Ativar solução alternativa do contador PowerShell", "description": "Quando ativado, adiciona um contador aos comandos PowerShell para garantir a execução correta dos comandos. Isso ajuda com terminais PowerShell que podem ter problemas com a captura de saída." + }, + "zshClearEolMark": { + "label": "Limpar marca de fim de linha do ZSH", + "description": "Quando ativado, limpa a marca de fim de linha do ZSH definindo PROMPT_EOL_MARK=''. Isso evita problemas com a interpretação da saída de comandos quando termina com caracteres especiais como '%'." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/tr/settings.json b/webview-ui/src/i18n/locales/tr/settings.json index 9d9aff5ae60..25538115e5d 100644 --- a/webview-ui/src/i18n/locales/tr/settings.json +++ b/webview-ui/src/i18n/locales/tr/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "PowerShell sayaç geçici çözümünü etkinleştir", "description": "Etkinleştirildiğinde, komutların doğru şekilde yürütülmesini sağlamak için PowerShell komutlarına bir sayaç ekler. Bu, çıktı yakalama sorunları yaşayabilecek PowerShell terminallerinde yardımcı olur." + }, + "zshClearEolMark": { + "label": "ZSH satır sonu işaretini temizle", + "description": "Etkinleştirildiğinde, PROMPT_EOL_MARK='' ayarlanarak ZSH satır sonu işaretini temizler. Bu, '%' gibi özel karakterlerle biten komut çıktılarının yorumlanmasında sorun yaşanmasını önler." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/vi/settings.json b/webview-ui/src/i18n/locales/vi/settings.json index 1fd61d9e53c..c886481aa8b 100644 --- a/webview-ui/src/i18n/locales/vi/settings.json +++ b/webview-ui/src/i18n/locales/vi/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "Bật giải pháp bộ đếm PowerShell", "description": "Khi được bật, thêm một bộ đếm vào các lệnh PowerShell để đảm bảo thực thi lệnh chính xác. Điều này giúp ích với các terminal PowerShell có thể gặp vấn đề về ghi lại đầu ra." + }, + "zshClearEolMark": { + "label": "Xóa dấu cuối dòng ZSH", + "description": "Khi được bật, xóa dấu cuối dòng ZSH bằng cách đặt PROMPT_EOL_MARK=''. Điều này ngăn chặn các vấn đề về diễn giải đầu ra lệnh khi kết thúc bằng các ký tự đặc biệt như '%'." } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index fb36e431b5a..aefd000c503 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "启用 PowerShell 计数器解决方案", "description": "启用后,会在 PowerShell 命令中添加计数器以确保命令正确执行。这有助于解决可能存在输出捕获问题的 PowerShell 终端。" + }, + "zshClearEolMark": { + "label": "清除 ZSH 行尾标记", + "description": "启用后,通过设置 PROMPT_EOL_MARK='' 清除 ZSH 行尾标记。这可以防止命令输出以特殊字符(如 '%')结尾时的解析问题。" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/zh-TW/settings.json b/webview-ui/src/i18n/locales/zh-TW/settings.json index 6a600695f4c..e223dd6283b 100644 --- a/webview-ui/src/i18n/locales/zh-TW/settings.json +++ b/webview-ui/src/i18n/locales/zh-TW/settings.json @@ -309,6 +309,10 @@ "powershellCounter": { "label": "啟用 PowerShell 計數器解決方案", "description": "啟用後,會在 PowerShell 命令中加入計數器以確保命令正確執行。這有助於解決可能存在輸出擷取問題的 PowerShell 終端機。" + }, + "zshClearEolMark": { + "label": "清除 ZSH 行尾標記", + "description": "啟用後,透過設定 PROMPT_EOL_MARK='' 清除 ZSH 行尾標記。這可以防止命令輸出以特殊字元(如 '%')結尾時的解析問題。" } }, "advanced": { From b4c67f133b606ba45d6a78793cd1795c6ca4d908 Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Thu, 10 Apr 2025 17:38:56 -0700 Subject: [PATCH 6/8] feat: add terminal settings for Oh My Zsh and Powerlevel10k shell integration Added two new terminal settings: - terminalZshOhMy: Sets ITERM_SHELL_INTEGRATION_INSTALLED=Yes for Oh My Zsh - terminalZshP10k: Sets POWERLEVEL9K_TERM_SHELL_INTEGRATION=true for Powerlevel10k Signed-off-by: Eric Wheeler --- src/core/webview/ClineProvider.ts | 10 +++++ src/core/webview/webviewMessageHandler.ts | 14 +++++++ src/exports/roo-code.d.ts | 2 + src/exports/types.ts | 2 + src/integrations/terminal/Terminal.ts | 34 +++++++++++++++ src/integrations/terminal/TerminalRegistry.ts | 10 +++++ .../__tests__/TerminalRegistry.test.ts | 42 +++++++++++++++++++ src/schemas/index.ts | 4 ++ src/shared/ExtensionMessage.ts | 2 + src/shared/WebviewMessage.ts | 2 + .../src/components/settings/SettingsView.tsx | 6 +++ .../components/settings/TerminalSettings.tsx | 30 +++++++++++++ .../src/context/ExtensionStateContext.tsx | 3 +- webview-ui/src/i18n/locales/ca/settings.json | 8 ++++ webview-ui/src/i18n/locales/de/settings.json | 8 ++++ webview-ui/src/i18n/locales/en/settings.json | 8 ++++ webview-ui/src/i18n/locales/es/settings.json | 8 ++++ webview-ui/src/i18n/locales/fr/settings.json | 8 ++++ webview-ui/src/i18n/locales/hi/settings.json | 8 ++++ webview-ui/src/i18n/locales/it/settings.json | 8 ++++ webview-ui/src/i18n/locales/ja/settings.json | 8 ++++ webview-ui/src/i18n/locales/ko/settings.json | 8 ++++ webview-ui/src/i18n/locales/pl/settings.json | 8 ++++ .../src/i18n/locales/pt-BR/settings.json | 8 ++++ webview-ui/src/i18n/locales/tr/settings.json | 8 ++++ webview-ui/src/i18n/locales/vi/settings.json | 8 ++++ .../src/i18n/locales/zh-CN/settings.json | 8 ++++ .../src/i18n/locales/zh-TW/settings.json | 8 ++++ 28 files changed, 280 insertions(+), 1 deletion(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index f87c23ff15f..798e79ddfc2 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -357,6 +357,8 @@ export class ClineProvider extends EventEmitter implements terminalShellIntegrationTimeout, terminalCommandDelay, terminalZshClearEolMark, + terminalZshOhMy, + terminalZshP10k, terminalPowershellCounter, }) => { setSoundEnabled(soundEnabled ?? false) @@ -365,6 +367,8 @@ export class ClineProvider extends EventEmitter implements ) Terminal.setCommandDelay(terminalCommandDelay ?? 0) Terminal.setTerminalZshClearEolMark(terminalZshClearEolMark ?? true) + Terminal.setTerminalZshOhMy(terminalZshOhMy ?? false) + Terminal.setTerminalZshP10k(terminalZshP10k ?? false) Terminal.setPowershellCounter(terminalPowershellCounter ?? false) }, ) @@ -1213,6 +1217,8 @@ export class ClineProvider extends EventEmitter implements terminalCommandDelay, terminalPowershellCounter, terminalZshClearEolMark, + terminalZshOhMy, + terminalZshP10k, fuzzyMatchThreshold, mcpEnabled, enableMcpServerCreation, @@ -1283,6 +1289,8 @@ export class ClineProvider extends EventEmitter implements terminalCommandDelay: terminalCommandDelay ?? 0, terminalPowershellCounter: terminalPowershellCounter ?? false, terminalZshClearEolMark: terminalZshClearEolMark ?? true, + terminalZshOhMy: terminalZshOhMy ?? false, + terminalZshP10k: terminalZshP10k ?? false, fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0, mcpEnabled: mcpEnabled ?? true, enableMcpServerCreation: enableMcpServerCreation ?? true, @@ -1372,6 +1380,8 @@ export class ClineProvider extends EventEmitter implements terminalCommandDelay: stateValues.terminalCommandDelay ?? 0, terminalPowershellCounter: stateValues.terminalPowershellCounter ?? false, terminalZshClearEolMark: stateValues.terminalZshClearEolMark ?? true, + terminalZshOhMy: stateValues.terminalZshOhMy ?? false, + terminalZshP10k: stateValues.terminalZshP10k ?? false, mode: stateValues.mode ?? defaultModeSlug, language: stateValues.language ?? formatLanguage(vscode.env.language), mcpEnabled: stateValues.mcpEnabled ?? true, diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 3a02e0f9370..7c6832e3e6d 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -757,6 +757,20 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We Terminal.setTerminalZshClearEolMark(message.bool) } break + case "terminalZshOhMy": + await updateGlobalState("terminalZshOhMy", message.bool) + await provider.postStateToWebview() + if (message.bool !== undefined) { + Terminal.setTerminalZshOhMy(message.bool) + } + break + case "terminalZshP10k": + await updateGlobalState("terminalZshP10k", message.bool) + await provider.postStateToWebview() + if (message.bool !== undefined) { + Terminal.setTerminalZshP10k(message.bool) + } + break case "mode": await provider.handleModeSwitch(message.text as Mode) break diff --git a/src/exports/roo-code.d.ts b/src/exports/roo-code.d.ts index 0aba68638c2..9c57f5063ca 100644 --- a/src/exports/roo-code.d.ts +++ b/src/exports/roo-code.d.ts @@ -269,6 +269,8 @@ type GlobalSettings = { terminalCommandDelay?: number | undefined terminalPowershellCounter?: boolean | undefined terminalZshClearEolMark?: boolean | undefined + terminalZshOhMy?: boolean | undefined + terminalZshP10k?: boolean | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/exports/types.ts b/src/exports/types.ts index 9a53ecdc7c8..9fb822c02a8 100644 --- a/src/exports/types.ts +++ b/src/exports/types.ts @@ -272,6 +272,8 @@ type GlobalSettings = { terminalCommandDelay?: number | undefined terminalPowershellCounter?: boolean | undefined terminalZshClearEolMark?: boolean | undefined + terminalZshOhMy?: boolean | undefined + terminalZshP10k?: boolean | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/integrations/terminal/Terminal.ts b/src/integrations/terminal/Terminal.ts index ed6dfd62bf3..76d7e916445 100644 --- a/src/integrations/terminal/Terminal.ts +++ b/src/integrations/terminal/Terminal.ts @@ -10,6 +10,8 @@ export class Terminal { private static commandDelay: number = 0 private static powershellCounter: boolean = false private static terminalZshClearEolMark: boolean = true + private static terminalZshOhMy: boolean = false + private static terminalZshP10k: boolean = false public terminal: vscode.Terminal public busy: boolean @@ -311,6 +313,38 @@ export class Terminal { return Terminal.terminalZshClearEolMark } + /** + * Sets whether to enable Oh My Zsh shell integration + * @param enabled Whether to enable Oh My Zsh shell integration + */ + public static setTerminalZshOhMy(enabled: boolean): void { + Terminal.terminalZshOhMy = enabled + } + + /** + * Gets whether Oh My Zsh shell integration is enabled + * @returns Whether Oh My Zsh shell integration is enabled + */ + public static getTerminalZshOhMy(): boolean { + return Terminal.terminalZshOhMy + } + + /** + * Sets whether to enable Powerlevel10k shell integration + * @param enabled Whether to enable Powerlevel10k shell integration + */ + public static setTerminalZshP10k(enabled: boolean): void { + Terminal.terminalZshP10k = enabled + } + + /** + * Gets whether Powerlevel10k shell integration is enabled + * @returns Whether Powerlevel10k shell integration is enabled + */ + public static getTerminalZshP10k(): boolean { + return Terminal.terminalZshP10k + } + public static compressTerminalOutput(input: string, lineLimit: number): string { return truncateOutput(applyRunLengthEncoding(input), lineLimit) } diff --git a/src/integrations/terminal/TerminalRegistry.ts b/src/integrations/terminal/TerminalRegistry.ts index 8dcf375225d..4b0d3fd6c30 100644 --- a/src/integrations/terminal/TerminalRegistry.ts +++ b/src/integrations/terminal/TerminalRegistry.ts @@ -117,6 +117,16 @@ export class TerminalRegistry { VTE_VERSION: "0", } + // Set Oh My Zsh shell integration if enabled + if (Terminal.getTerminalZshOhMy()) { + env.ITERM_SHELL_INTEGRATION_INSTALLED = "Yes" + } + + // Set Powerlevel10k shell integration if enabled + if (Terminal.getTerminalZshP10k()) { + env.POWERLEVEL9K_TERM_SHELL_INTEGRATION = "true" + } + // VSCode bug#237208: Command output can be lost due to a race between completion // sequences and consumers. Add delay via PROMPT_COMMAND to ensure the // \x1b]633;D escape sequence arrives after command output is processed. diff --git a/src/integrations/terminal/__tests__/TerminalRegistry.test.ts b/src/integrations/terminal/__tests__/TerminalRegistry.test.ts index 5b9d42f92dd..d80087cc9c7 100644 --- a/src/integrations/terminal/__tests__/TerminalRegistry.test.ts +++ b/src/integrations/terminal/__tests__/TerminalRegistry.test.ts @@ -62,5 +62,47 @@ describe("TerminalRegistry", () => { Terminal.setCommandDelay(originalDelay) } }) + + it("adds Oh My Zsh integration env var when enabled", () => { + Terminal.setTerminalZshOhMy(true) + try { + TerminalRegistry.createTerminal("/test/path") + + expect(mockCreateTerminal).toHaveBeenCalledWith({ + cwd: "/test/path", + name: "Roo Code", + iconPath: expect.any(Object), + env: { + PAGER: "cat", + VTE_VERSION: "0", + PROMPT_EOL_MARK: "", + ITERM_SHELL_INTEGRATION_INSTALLED: "Yes", + }, + }) + } finally { + Terminal.setTerminalZshOhMy(false) + } + }) + + it("adds Powerlevel10k integration env var when enabled", () => { + Terminal.setTerminalZshP10k(true) + try { + TerminalRegistry.createTerminal("/test/path") + + expect(mockCreateTerminal).toHaveBeenCalledWith({ + cwd: "/test/path", + name: "Roo Code", + iconPath: expect.any(Object), + env: { + PAGER: "cat", + VTE_VERSION: "0", + PROMPT_EOL_MARK: "", + POWERLEVEL9K_TERM_SHELL_INTEGRATION: "true", + }, + }) + } finally { + Terminal.setTerminalZshP10k(false) + } + }) }) }) diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 9f7d78be361..03834fdcf93 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -535,6 +535,8 @@ export const globalSettingsSchema = z.object({ terminalCommandDelay: z.number().optional(), terminalPowershellCounter: z.boolean().optional(), terminalZshClearEolMark: z.boolean().optional(), + terminalZshOhMy: z.boolean().optional(), + terminalZshP10k: z.boolean().optional(), rateLimitSeconds: z.number().optional(), diffEnabled: z.boolean().optional(), @@ -608,6 +610,8 @@ const globalSettingsRecord: GlobalSettingsRecord = { terminalCommandDelay: undefined, terminalPowershellCounter: undefined, terminalZshClearEolMark: undefined, + terminalZshOhMy: undefined, + terminalZshP10k: undefined, rateLimitSeconds: undefined, diffEnabled: undefined, diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 6e00f7e3b44..1c978e1b98d 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -156,6 +156,8 @@ export type ExtensionState = Pick< | "terminalCommandDelay" | "terminalPowershellCounter" | "terminalZshClearEolMark" + | "terminalZshOhMy" + | "terminalZshP10k" | "diffEnabled" | "fuzzyMatchThreshold" // | "experiments" // Optional in GlobalSettings, required here. diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index 3fd74b99c54..987c6ef0eeb 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -85,6 +85,8 @@ export interface WebviewMessage { | "terminalCommandDelay" | "terminalPowershellCounter" | "terminalZshClearEolMark" + | "terminalZshOhMy" + | "terminalZshP10k" | "mcpEnabled" | "enableMcpServerCreation" | "searchCommits" diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 8384f2208e9..16a6d29acba 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -132,6 +132,8 @@ const SettingsView = forwardRef(({ onDone, t terminalCommandDelay, terminalPowershellCounter, terminalZshClearEolMark, + terminalZshOhMy, + terminalZshP10k, writeDelayMs, showRooIgnoredFiles, remoteBrowserEnabled, @@ -243,6 +245,8 @@ const SettingsView = forwardRef(({ onDone, t vscode.postMessage({ type: "terminalCommandDelay", value: terminalCommandDelay }) vscode.postMessage({ type: "terminalPowershellCounter", bool: terminalPowershellCounter }) vscode.postMessage({ type: "terminalZshClearEolMark", bool: terminalZshClearEolMark }) + vscode.postMessage({ type: "terminalZshOhMy", bool: terminalZshOhMy }) + vscode.postMessage({ type: "terminalZshP10k", bool: terminalZshP10k }) vscode.postMessage({ type: "mcpEnabled", bool: mcpEnabled }) vscode.postMessage({ type: "alwaysApproveResubmit", bool: alwaysApproveResubmit }) vscode.postMessage({ type: "requestDelaySeconds", value: requestDelaySeconds }) @@ -490,6 +494,8 @@ const SettingsView = forwardRef(({ onDone, t terminalCommandDelay={terminalCommandDelay} terminalPowershellCounter={terminalPowershellCounter} terminalZshClearEolMark={terminalZshClearEolMark} + terminalZshOhMy={terminalZshOhMy} + terminalZshP10k={terminalZshP10k} setCachedStateField={setCachedStateField} /> diff --git a/webview-ui/src/components/settings/TerminalSettings.tsx b/webview-ui/src/components/settings/TerminalSettings.tsx index 613725d65b3..0b97ca1ee3a 100644 --- a/webview-ui/src/components/settings/TerminalSettings.tsx +++ b/webview-ui/src/components/settings/TerminalSettings.tsx @@ -16,12 +16,16 @@ type TerminalSettingsProps = HTMLAttributes & { terminalCommandDelay?: number terminalPowershellCounter?: boolean terminalZshClearEolMark?: boolean + terminalZshOhMy?: boolean + terminalZshP10k?: boolean setCachedStateField: SetCachedStateField< | "terminalOutputLineLimit" | "terminalShellIntegrationTimeout" | "terminalCommandDelay" | "terminalPowershellCounter" | "terminalZshClearEolMark" + | "terminalZshOhMy" + | "terminalZshP10k" > } @@ -31,6 +35,8 @@ export const TerminalSettings = ({ terminalCommandDelay, terminalPowershellCounter, terminalZshClearEolMark, + terminalZshOhMy, + terminalZshP10k, setCachedStateField, className, ...props @@ -131,6 +137,30 @@ export const TerminalSettings = ({ {t("settings:terminal.zshClearEolMark.description")} + +
+ setCachedStateField("terminalZshOhMy", e.target.checked)} + data-testid="terminal-zsh-oh-my-checkbox"> + {t("settings:terminal.zshOhMy.label")} + +
+ {t("settings:terminal.zshOhMy.description")} +
+
+ +
+ setCachedStateField("terminalZshP10k", e.target.checked)} + data-testid="terminal-zsh-p10k-checkbox"> + {t("settings:terminal.zshP10k.label")} + +
+ {t("settings:terminal.zshP10k.description")} +
+
) diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index 477c9f9f7c5..a4dc2eca9a8 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -158,6 +158,8 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode renderContext: "sidebar", maxReadFileLine: 500, // Default max read file line limit pinnedApiConfigs: {}, // Empty object for pinned API configs + terminalZshOhMy: false, // Default Oh My Zsh integration setting + terminalZshP10k: false, // Default Powerlevel10k integration setting }) const [didHydrateState, setDidHydrateState] = useState(false) @@ -165,7 +167,6 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode const [theme, setTheme] = useState(undefined) const [filePaths, setFilePaths] = useState([]) const [openedTabs, setOpenedTabs] = useState>([]) - const [mcpServers, setMcpServers] = useState([]) const [currentCheckpoint, setCurrentCheckpoint] = useState() diff --git a/webview-ui/src/i18n/locales/ca/settings.json b/webview-ui/src/i18n/locales/ca/settings.json index 42510a36878..eba65bd3c99 100644 --- a/webview-ui/src/i18n/locales/ca/settings.json +++ b/webview-ui/src/i18n/locales/ca/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "Neteja la marca EOL de ZSH", "description": "Quan està habilitat, neteja la marca de final de línia de ZSH establint PROMPT_EOL_MARK=''. Això evita problemes amb la interpretació de la sortida de comandes quan acaba amb caràcters especials com '%'." + }, + "zshOhMy": { + "label": "Habilita la integració Oh My Zsh", + "description": "Quan està habilitat, estableix ITERM_SHELL_INTEGRATION_INSTALLED=Yes per habilitar les característiques d'integració del shell Oh My Zsh. (experimental)" + }, + "zshP10k": { + "label": "Habilita la integració Powerlevel10k", + "description": "Quan està habilitat, estableix POWERLEVEL9K_TERM_SHELL_INTEGRATION=true per habilitar les característiques d'integració del shell Powerlevel10k. (experimental)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index ce960f966de..4147623f0a3 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "ZSH-Zeilenende-Markierung löschen", "description": "Wenn aktiviert, wird die ZSH-Zeilenende-Markierung durch Setzen von PROMPT_EOL_MARK='' gelöscht. Dies verhindert Probleme bei der Interpretation der Befehlsausgabe, wenn diese mit Sonderzeichen wie '%' endet." + }, + "zshOhMy": { + "label": "Oh My Zsh-Integration aktivieren", + "description": "Wenn aktiviert, wird ITERM_SHELL_INTEGRATION_INSTALLED=Yes gesetzt, um die Shell-Integrationsfunktionen von Oh My Zsh zu aktivieren. (experimentell)" + }, + "zshP10k": { + "label": "Powerlevel10k-Integration aktivieren", + "description": "Wenn aktiviert, wird POWERLEVEL9K_TERM_SHELL_INTEGRATION=true gesetzt, um die Shell-Integrationsfunktionen von Powerlevel10k zu aktivieren. (experimentell)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index fdb846156c0..70955c932b3 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "Clear ZSH EOL mark", "description": "When enabled, clears the ZSH end-of-line mark by setting PROMPT_EOL_MARK=''. This prevents issues with command output interpretation when output ends with special characters like '%'." + }, + "zshOhMy": { + "label": "Enable Oh My Zsh integration", + "description": "When enabled, sets ITERM_SHELL_INTEGRATION_INSTALLED=Yes to enable Oh My Zsh shell integration features. (experimental)" + }, + "zshP10k": { + "label": "Enable Powerlevel10k integration", + "description": "When enabled, sets POWERLEVEL9K_TERM_SHELL_INTEGRATION=true to enable Powerlevel10k shell integration features. (experimental)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index 5fac4e5a418..744a91a8438 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "Limpiar marca de fin de línea de ZSH", "description": "Cuando está habilitado, limpia la marca de fin de línea de ZSH estableciendo PROMPT_EOL_MARK=''. Esto evita problemas con la interpretación de la salida de comandos cuando termina con caracteres especiales como '%'." + }, + "zshOhMy": { + "label": "Habilitar integración Oh My Zsh", + "description": "Cuando está habilitado, establece ITERM_SHELL_INTEGRATION_INSTALLED=Yes para habilitar las características de integración del shell Oh My Zsh. (experimental)" + }, + "zshP10k": { + "label": "Habilitar integración Powerlevel10k", + "description": "Cuando está habilitado, establece POWERLEVEL9K_TERM_SHELL_INTEGRATION=true para habilitar las características de integración del shell Powerlevel10k. (experimental)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index f98c9406638..eabb55aca17 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "Effacer la marque de fin de ligne ZSH", "description": "Lorsqu'activé, efface la marque de fin de ligne ZSH en définissant PROMPT_EOL_MARK=''. Cela évite les problèmes d'interprétation de la sortie des commandes lorsqu'elle se termine par des caractères spéciaux comme '%'." + }, + "zshOhMy": { + "label": "Activer l'intégration Oh My Zsh", + "description": "Lorsqu'activé, définit ITERM_SHELL_INTEGRATION_INSTALLED=Yes pour activer les fonctionnalités d'intégration du shell Oh My Zsh. (expérimental)" + }, + "zshP10k": { + "label": "Activer l'intégration Powerlevel10k", + "description": "Lorsqu'activé, définit POWERLEVEL9K_TERM_SHELL_INTEGRATION=true pour activer les fonctionnalités d'intégration du shell Powerlevel10k. (expérimental)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/hi/settings.json b/webview-ui/src/i18n/locales/hi/settings.json index dc1f1b2712c..b8ae551287c 100644 --- a/webview-ui/src/i18n/locales/hi/settings.json +++ b/webview-ui/src/i18n/locales/hi/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "ZSH EOL मार्क साफ़ करें", "description": "सक्षम होने पर, PROMPT_EOL_MARK='' सेट करके ZSH लाइन-समाप्ति मार्क को साफ़ करता है। यह कमांड आउटपुट की व्याख्या में समस्याओं को रोकता है जब आउटपुट '%' जैसे विशेष वर्णों के साथ समाप्त होता है।" + }, + "zshOhMy": { + "label": "Oh My Zsh एकीकरण सक्षम करें", + "description": "सक्षम होने पर, Oh My Zsh शेल एकीकरण सुविधाओं को सक्षम करने के लिए ITERM_SHELL_INTEGRATION_INSTALLED=Yes सेट करता है। (प्रयोगात्मक)" + }, + "zshP10k": { + "label": "Powerlevel10k एकीकरण सक्षम करें", + "description": "सक्षम होने पर, Powerlevel10k शेल एकीकरण सुविधाओं को सक्षम करने के लिए POWERLEVEL9K_TERM_SHELL_INTEGRATION=true सेट करता है। (प्रयोगात्मक)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index 69fe311b86a..3cade75da0a 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "Cancella marcatore fine riga ZSH", "description": "Quando abilitato, cancella il marcatore di fine riga ZSH impostando PROMPT_EOL_MARK=''. Questo previene problemi con l'interpretazione dell'output dei comandi quando termina con caratteri speciali come '%'." + }, + "zshOhMy": { + "label": "Abilita integrazione Oh My Zsh", + "description": "Quando abilitato, imposta ITERM_SHELL_INTEGRATION_INSTALLED=Yes per abilitare le funzionalità di integrazione della shell Oh My Zsh. (sperimentale)" + }, + "zshP10k": { + "label": "Abilita integrazione Powerlevel10k", + "description": "Quando abilitato, imposta POWERLEVEL9K_TERM_SHELL_INTEGRATION=true per abilitare le funzionalità di integrazione della shell Powerlevel10k. (sperimentale)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index 7c76d7afd75..06a49e161db 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "ZSH行末マークをクリア", "description": "有効にすると、PROMPT_EOL_MARK=''を設定してZSHの行末マークをクリアします。これにより、'%'などの特殊文字で終わるコマンド出力の解釈に関する問題を防ぎます。" + }, + "zshOhMy": { + "label": "Oh My Zsh 統合を有効化", + "description": "有効にすると、ITERM_SHELL_INTEGRATION_INSTALLED=Yes を設定して Oh My Zsh シェル統合機能を有効にします。(実験的)" + }, + "zshP10k": { + "label": "Powerlevel10k 統合を有効化", + "description": "有効にすると、POWERLEVEL9K_TERM_SHELL_INTEGRATION=true を設定して Powerlevel10k シェル統合機能を有効にします。(実験的)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/ko/settings.json b/webview-ui/src/i18n/locales/ko/settings.json index 9d1ec745f29..5461f32907d 100644 --- a/webview-ui/src/i18n/locales/ko/settings.json +++ b/webview-ui/src/i18n/locales/ko/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "ZSH 줄 끝 표시 지우기", "description": "활성화하면 PROMPT_EOL_MARK=''를 설정하여 ZSH 줄 끝 표시를 지웁니다. 이는 '%'와 같은 특수 문자로 끝나는 명령 출력 해석의 문제를 방지합니다." + }, + "zshOhMy": { + "label": "Oh My Zsh 통합 활성화", + "description": "활성화하면 ITERM_SHELL_INTEGRATION_INSTALLED=Yes를 설정하여 Oh My Zsh 셸 통합 기능을 활성화합니다. (실험적)" + }, + "zshP10k": { + "label": "Powerlevel10k 통합 활성화", + "description": "활성화하면 POWERLEVEL9K_TERM_SHELL_INTEGRATION=true를 설정하여 Powerlevel10k 셸 통합 기능을 활성화합니다. (실험적)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/pl/settings.json b/webview-ui/src/i18n/locales/pl/settings.json index 1ec0b3d7fdf..28d718bc5a5 100644 --- a/webview-ui/src/i18n/locales/pl/settings.json +++ b/webview-ui/src/i18n/locales/pl/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "Wyczyść znacznik końca linii ZSH", "description": "Po włączeniu czyści znacznik końca linii ZSH poprzez ustawienie PROMPT_EOL_MARK=''. Zapobiega to problemom z interpretacją wyjścia poleceń, gdy kończy się ono znakami specjalnymi jak '%'." + }, + "zshOhMy": { + "label": "Włącz integrację Oh My Zsh", + "description": "Po włączeniu ustawia ITERM_SHELL_INTEGRATION_INSTALLED=Yes, aby włączyć funkcje integracji powłoki Oh My Zsh. (eksperymentalne)" + }, + "zshP10k": { + "label": "Włącz integrację Powerlevel10k", + "description": "Po włączeniu ustawia POWERLEVEL9K_TERM_SHELL_INTEGRATION=true, aby włączyć funkcje integracji powłoki Powerlevel10k. (eksperymentalne)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index f9670b1edcc..e1bdb000152 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "Limpar marca de fim de linha do ZSH", "description": "Quando ativado, limpa a marca de fim de linha do ZSH definindo PROMPT_EOL_MARK=''. Isso evita problemas com a interpretação da saída de comandos quando termina com caracteres especiais como '%'." + }, + "zshOhMy": { + "label": "Ativar integração Oh My Zsh", + "description": "Quando ativado, define ITERM_SHELL_INTEGRATION_INSTALLED=Yes para habilitar os recursos de integração do shell Oh My Zsh. (experimental)" + }, + "zshP10k": { + "label": "Ativar integração Powerlevel10k", + "description": "Quando ativado, define POWERLEVEL9K_TERM_SHELL_INTEGRATION=true para habilitar os recursos de integração do shell Powerlevel10k. (experimental)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/tr/settings.json b/webview-ui/src/i18n/locales/tr/settings.json index 25538115e5d..14c147cc481 100644 --- a/webview-ui/src/i18n/locales/tr/settings.json +++ b/webview-ui/src/i18n/locales/tr/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "ZSH satır sonu işaretini temizle", "description": "Etkinleştirildiğinde, PROMPT_EOL_MARK='' ayarlanarak ZSH satır sonu işaretini temizler. Bu, '%' gibi özel karakterlerle biten komut çıktılarının yorumlanmasında sorun yaşanmasını önler." + }, + "zshOhMy": { + "label": "Oh My Zsh entegrasyonunu etkinleştir", + "description": "Etkinleştirildiğinde, Oh My Zsh kabuk entegrasyon özelliklerini etkinleştirmek için ITERM_SHELL_INTEGRATION_INSTALLED=Yes ayarlar. (deneysel)" + }, + "zshP10k": { + "label": "Powerlevel10k entegrasyonunu etkinleştir", + "description": "Etkinleştirildiğinde, Powerlevel10k kabuk entegrasyon özelliklerini etkinleştirmek için POWERLEVEL9K_TERM_SHELL_INTEGRATION=true ayarlar. (deneysel)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/vi/settings.json b/webview-ui/src/i18n/locales/vi/settings.json index c886481aa8b..69f76bac138 100644 --- a/webview-ui/src/i18n/locales/vi/settings.json +++ b/webview-ui/src/i18n/locales/vi/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "Xóa dấu cuối dòng ZSH", "description": "Khi được bật, xóa dấu cuối dòng ZSH bằng cách đặt PROMPT_EOL_MARK=''. Điều này ngăn chặn các vấn đề về diễn giải đầu ra lệnh khi kết thúc bằng các ký tự đặc biệt như '%'." + }, + "zshOhMy": { + "label": "Bật tích hợp Oh My Zsh", + "description": "Khi được bật, đặt ITERM_SHELL_INTEGRATION_INSTALLED=Yes để kích hoạt các tính năng tích hợp shell của Oh My Zsh. (thử nghiệm)" + }, + "zshP10k": { + "label": "Bật tích hợp Powerlevel10k", + "description": "Khi được bật, đặt POWERLEVEL9K_TERM_SHELL_INTEGRATION=true để kích hoạt các tính năng tích hợp shell của Powerlevel10k. (thử nghiệm)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index aefd000c503..8d4f1ed5933 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "清除 ZSH 行尾标记", "description": "启用后,通过设置 PROMPT_EOL_MARK='' 清除 ZSH 行尾标记。这可以防止命令输出以特殊字符(如 '%')结尾时的解析问题。" + }, + "zshOhMy": { + "label": "启用 Oh My Zsh 集成", + "description": "启用后,设置 ITERM_SHELL_INTEGRATION_INSTALLED=Yes 以启用 Oh My Zsh shell 集成功能。(实验性)" + }, + "zshP10k": { + "label": "启用 Powerlevel10k 集成", + "description": "启用后,设置 POWERLEVEL9K_TERM_SHELL_INTEGRATION=true 以启用 Powerlevel10k shell 集成功能。(实验性)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/zh-TW/settings.json b/webview-ui/src/i18n/locales/zh-TW/settings.json index e223dd6283b..d3e6dc9280e 100644 --- a/webview-ui/src/i18n/locales/zh-TW/settings.json +++ b/webview-ui/src/i18n/locales/zh-TW/settings.json @@ -313,6 +313,14 @@ "zshClearEolMark": { "label": "清除 ZSH 行尾標記", "description": "啟用後,透過設定 PROMPT_EOL_MARK='' 清除 ZSH 行尾標記。這可以防止命令輸出以特殊字元(如 '%')結尾時的解析問題。" + }, + "zshOhMy": { + "label": "啟用 Oh My Zsh 整合", + "description": "啟用後,設定 ITERM_SHELL_INTEGRATION_INSTALLED=Yes 以啟用 Oh My Zsh shell 整合功能。(實驗性)" + }, + "zshP10k": { + "label": "啟用 Powerlevel10k 整合", + "description": "啟用後,設定 POWERLEVEL9K_TERM_SHELL_INTEGRATION=true 以啟用 Powerlevel10k shell 整合功能。(實驗性)" } }, "advanced": { From 4ef62c6a1358cfca9756a084d4c17404a3c604ec Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Thu, 10 Apr 2025 21:18:02 -0700 Subject: [PATCH 7/8] feat: add ZDOTDIR handling for zsh shell integration Creates a temporary ZDOTDIR to handle zsh shell integration properly while preserving user's zsh configuration. This ensures VSCode shell integration works correctly with zsh without modifying the user's existing setup. - Add terminalZdotdir setting (disabled by default) - Create temporary directory with proper security (sticky bit) - Add automatic cleanup on terminal close - Add translations for all supported languages User confirmed fixes: Fixes: #2205 Fixes: #2129 Signed-off-by: Eric Wheeler --- src/core/webview/ClineProvider.ts | 5 + src/core/webview/webviewMessageHandler.ts | 7 + src/exports/roo-code.d.ts | 1 + src/exports/types.ts | 1 + src/integrations/terminal/Terminal.ts | 25 +++ src/integrations/terminal/TerminalRegistry.ts | 174 ++++++++++++++++++ .../TerminalProcessExec.bash.test.ts | 5 + .../__tests__/TerminalProcessExec.cmd.test.ts | 5 + .../TerminalProcessExec.pwsh.test.ts | 5 + .../__tests__/TerminalRegistry.test.ts | 1 + src/schemas/index.ts | 2 + src/shared/ExtensionMessage.ts | 1 + src/shared/WebviewMessage.ts | 1 + .../src/components/settings/SettingsView.tsx | 3 + .../components/settings/TerminalSettings.tsx | 15 ++ .../src/context/ExtensionStateContext.tsx | 4 + webview-ui/src/i18n/locales/ca/settings.json | 4 + webview-ui/src/i18n/locales/de/settings.json | 4 + webview-ui/src/i18n/locales/en/settings.json | 4 + webview-ui/src/i18n/locales/es/settings.json | 4 + webview-ui/src/i18n/locales/fr/settings.json | 4 + webview-ui/src/i18n/locales/hi/settings.json | 4 + webview-ui/src/i18n/locales/it/settings.json | 4 + webview-ui/src/i18n/locales/ja/settings.json | 4 + webview-ui/src/i18n/locales/ko/settings.json | 4 + webview-ui/src/i18n/locales/pl/settings.json | 4 + .../src/i18n/locales/pt-BR/settings.json | 4 + webview-ui/src/i18n/locales/tr/settings.json | 4 + webview-ui/src/i18n/locales/vi/settings.json | 4 + .../src/i18n/locales/zh-CN/settings.json | 4 + .../src/i18n/locales/zh-TW/settings.json | 4 + 31 files changed, 315 insertions(+) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 798e79ddfc2..66f7a4ef0ee 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -360,6 +360,7 @@ export class ClineProvider extends EventEmitter implements terminalZshOhMy, terminalZshP10k, terminalPowershellCounter, + terminalZdotdir, }) => { setSoundEnabled(soundEnabled ?? false) Terminal.setShellIntegrationTimeout( @@ -370,6 +371,7 @@ export class ClineProvider extends EventEmitter implements Terminal.setTerminalZshOhMy(terminalZshOhMy ?? false) Terminal.setTerminalZshP10k(terminalZshP10k ?? false) Terminal.setPowershellCounter(terminalPowershellCounter ?? false) + Terminal.setTerminalZdotdir(terminalZdotdir ?? false) }, ) @@ -1219,6 +1221,7 @@ export class ClineProvider extends EventEmitter implements terminalZshClearEolMark, terminalZshOhMy, terminalZshP10k, + terminalZdotdir, fuzzyMatchThreshold, mcpEnabled, enableMcpServerCreation, @@ -1291,6 +1294,7 @@ export class ClineProvider extends EventEmitter implements terminalZshClearEolMark: terminalZshClearEolMark ?? true, terminalZshOhMy: terminalZshOhMy ?? false, terminalZshP10k: terminalZshP10k ?? false, + terminalZdotdir: terminalZdotdir ?? false, fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0, mcpEnabled: mcpEnabled ?? true, enableMcpServerCreation: enableMcpServerCreation ?? true, @@ -1382,6 +1386,7 @@ export class ClineProvider extends EventEmitter implements terminalZshClearEolMark: stateValues.terminalZshClearEolMark ?? true, terminalZshOhMy: stateValues.terminalZshOhMy ?? false, terminalZshP10k: stateValues.terminalZshP10k ?? false, + terminalZdotdir: stateValues.terminalZdotdir ?? false, mode: stateValues.mode ?? defaultModeSlug, language: stateValues.language ?? formatLanguage(vscode.env.language), mcpEnabled: stateValues.mcpEnabled ?? true, diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 7c6832e3e6d..ac78088f4c1 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -771,6 +771,13 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We Terminal.setTerminalZshP10k(message.bool) } break + case "terminalZdotdir": + await updateGlobalState("terminalZdotdir", message.bool) + await provider.postStateToWebview() + if (message.bool !== undefined) { + Terminal.setTerminalZdotdir(message.bool) + } + break case "mode": await provider.handleModeSwitch(message.text as Mode) break diff --git a/src/exports/roo-code.d.ts b/src/exports/roo-code.d.ts index 9c57f5063ca..8e7615f33f3 100644 --- a/src/exports/roo-code.d.ts +++ b/src/exports/roo-code.d.ts @@ -271,6 +271,7 @@ type GlobalSettings = { terminalZshClearEolMark?: boolean | undefined terminalZshOhMy?: boolean | undefined terminalZshP10k?: boolean | undefined + terminalZdotdir?: boolean | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/exports/types.ts b/src/exports/types.ts index 9fb822c02a8..d75c9818b90 100644 --- a/src/exports/types.ts +++ b/src/exports/types.ts @@ -274,6 +274,7 @@ type GlobalSettings = { terminalZshClearEolMark?: boolean | undefined terminalZshOhMy?: boolean | undefined terminalZshP10k?: boolean | undefined + terminalZdotdir?: boolean | undefined rateLimitSeconds?: number | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined diff --git a/src/integrations/terminal/Terminal.ts b/src/integrations/terminal/Terminal.ts index 76d7e916445..e17d01fa48f 100644 --- a/src/integrations/terminal/Terminal.ts +++ b/src/integrations/terminal/Terminal.ts @@ -2,6 +2,8 @@ import * as vscode from "vscode" import pWaitFor from "p-wait-for" import { ExitCodeDetails, mergePromise, TerminalProcess, TerminalProcessResultPromise } from "./TerminalProcess" import { truncateOutput, applyRunLengthEncoding } from "../misc/extract-text" +// Import TerminalRegistry here to avoid circular dependencies +const { TerminalRegistry } = require("./TerminalRegistry") export const TERMINAL_SHELL_INTEGRATION_TIMEOUT = 5000 @@ -12,6 +14,7 @@ export class Terminal { private static terminalZshClearEolMark: boolean = true private static terminalZshOhMy: boolean = false private static terminalZshP10k: boolean = false + private static terminalZdotdir: boolean = false public terminal: vscode.Terminal public busy: boolean @@ -185,10 +188,16 @@ export class Terminal { // Wait for shell integration before executing the command pWaitFor(() => this.terminal.shellIntegration !== undefined, { timeout: Terminal.shellIntegrationTimeout }) .then(() => { + // Clean up temporary directory if shell integration is available, zsh did its job: + TerminalRegistry.zshCleanupTmpDir(this.id) + + // Run the command in the terminal process.run(command) }) .catch(() => { console.log(`[Terminal ${this.id}] Shell integration not available. Command execution aborted.`) + // Clean up temporary directory if shell integration is not available + TerminalRegistry.zshCleanupTmpDir(this.id) process.emit( "no_shell_integration", `Shell integration initialization sequence '\\x1b]633;A' was not received within ${Terminal.shellIntegrationTimeout / 1000}s. Shell integration has been disabled for this terminal instance. Increase the timeout in the settings if necessary.`, @@ -348,4 +357,20 @@ export class Terminal { public static compressTerminalOutput(input: string, lineLimit: number): string { return truncateOutput(applyRunLengthEncoding(input), lineLimit) } + + /** + * Sets whether to enable ZDOTDIR handling for zsh + * @param enabled Whether to enable ZDOTDIR handling + */ + public static setTerminalZdotdir(enabled: boolean): void { + Terminal.terminalZdotdir = enabled + } + + /** + * Gets whether ZDOTDIR handling is enabled + * @returns Whether ZDOTDIR handling is enabled + */ + public static getTerminalZdotdir(): boolean { + return Terminal.terminalZdotdir + } } diff --git a/src/integrations/terminal/TerminalRegistry.ts b/src/integrations/terminal/TerminalRegistry.ts index 4b0d3fd6c30..e136078de9b 100644 --- a/src/integrations/terminal/TerminalRegistry.ts +++ b/src/integrations/terminal/TerminalRegistry.ts @@ -1,4 +1,5 @@ import * as vscode from "vscode" +import * as path from "path" import { arePathsEqual } from "../../utils/path" import { Terminal } from "./Terminal" import { TerminalProcess } from "./TerminalProcess" @@ -9,6 +10,7 @@ export class TerminalRegistry { private static terminals: Terminal[] = [] private static nextTerminalId = 1 private static disposables: vscode.Disposable[] = [] + private static terminalTmpDirs: Map = new Map() private static isInitialized = false static initialize() { @@ -17,6 +19,18 @@ export class TerminalRegistry { } this.isInitialized = true + // Register handler for terminal close events to clean up temporary directories + const closeDisposable = vscode.window.onDidCloseTerminal((terminal) => { + const terminalInfo = this.getTerminalByVSCETerminal(terminal) + if (terminalInfo) { + // Clean up temporary directory if it exists + if (this.terminalTmpDirs.has(terminalInfo.id)) { + this.zshCleanupTmpDir(terminalInfo.id) + } + } + }) + this.disposables.push(closeDisposable) + try { // onDidStartTerminalShellExecution const startDisposable = vscode.window.onDidStartTerminalShellExecution?.( @@ -141,6 +155,11 @@ export class TerminalRegistry { env.PROMPT_EOL_MARK = "" } + // Handle ZDOTDIR for zsh if enabled + if (Terminal.getTerminalZdotdir()) { + env.ZDOTDIR = this.zshInitTmpDir(env) + } + const terminal = vscode.window.createTerminal({ cwd, name: "Roo Code", @@ -151,6 +170,13 @@ export class TerminalRegistry { const cwdString = cwd.toString() const newTerminal = new Terminal(this.nextTerminalId++, terminal, cwdString) + if (Terminal.getTerminalZdotdir()) { + this.terminalTmpDirs.set(newTerminal.id, env.ZDOTDIR) + console.info( + `[TerminalRegistry] Stored temporary directory path for terminal ${newTerminal.id}: ${env.ZDOTDIR}`, + ) + } + this.terminals.push(newTerminal) return newTerminal } @@ -191,6 +217,8 @@ export class TerminalRegistry { } static removeTerminal(id: number) { + this.zshCleanupTmpDir(id) + this.terminals = this.terminals.filter((t) => t.id !== id) } @@ -279,10 +307,156 @@ export class TerminalRegistry { } static cleanup() { + // Clean up all temporary directories + this.terminalTmpDirs.forEach((_, terminalId) => { + this.zshCleanupTmpDir(terminalId) + }) + this.terminalTmpDirs.clear() + this.disposables.forEach((disposable) => disposable.dispose()) this.disposables = [] } + /** + * Gets the path to the shell integration script for a given shell type + * @param shell The shell type + * @returns The path to the shell integration script + */ + private static getShellIntegrationPath(shell: "bash" | "pwsh" | "zsh" | "fish"): string { + let filename: string + + switch (shell) { + case "bash": + filename = "shellIntegration-bash.sh" + break + case "pwsh": + filename = "shellIntegration.ps1" + break + case "zsh": + filename = "shellIntegration-rc.zsh" + break + case "fish": + filename = "shellIntegration.fish" + break + default: + throw new Error(`Invalid shell type: ${shell}`) + } + + // This is the same path used by the CLI command + return path.join( + vscode.env.appRoot, + "out", + "vs", + "workbench", + "contrib", + "terminal", + "common", + "scripts", + filename, + ) + } + + /** + * Initialize a temporary directory for ZDOTDIR + * @param env The environment variables object to modify + * @returns The path to the temporary directory + */ + private static zshInitTmpDir(env: Record): string { + // Create a temporary directory with the sticky bit set for security + const os = require("os") + const path = require("path") + const tmpDir = path.join(os.tmpdir(), `roo-zdotdir-${Math.random().toString(36).substring(2, 15)}`) + console.info(`[TerminalRegistry] Creating temporary directory for ZDOTDIR: ${tmpDir}`) + + // Save original ZDOTDIR as ROO_ZDOTDIR + if (process.env.ZDOTDIR) { + env.ROO_ZDOTDIR = process.env.ZDOTDIR + } + + // Create the temporary directory + vscode.workspace.fs + .createDirectory(vscode.Uri.file(tmpDir)) + .then(() => { + console.info(`[TerminalRegistry] Created temporary directory for ZDOTDIR at ${tmpDir}`) + + // Create .zshrc in the temporary directory + const zshrcPath = `${tmpDir}/.zshrc` + + // Get the path to the shell integration script + const shellIntegrationPath = this.getShellIntegrationPath("zsh") + + const zshrcContent = ` +source "${shellIntegrationPath}" +ZDOTDIR=\${ROO_ZDOTDIR:-$HOME} +unset ROO_ZDOTDIR +[ -f "$ZDOTDIR/.zshenv" ] && source "$ZDOTDIR/.zshenv" +[ -f "$ZDOTDIR/.zprofile" ] && source "$ZDOTDIR/.zprofile" +[ -f "$ZDOTDIR/.zshrc" ] && source "$ZDOTDIR/.zshrc" +[ -f "$ZDOTDIR/.zlogin" ] && source "$ZDOTDIR/.zlogin" +[ "$ZDOTDIR" = "$HOME" ] && unset ZDOTDIR +` + console.info(`[TerminalRegistry] Creating .zshrc file at ${zshrcPath} with content:\n${zshrcContent}`) + vscode.workspace.fs.writeFile(vscode.Uri.file(zshrcPath), Buffer.from(zshrcContent)).then( + // Success handler + () => { + console.info(`[TerminalRegistry] Successfully created .zshrc file at ${zshrcPath}`) + }, + // Error handler + (error: Error) => { + console.error(`[TerminalRegistry] Error creating .zshrc file at ${zshrcPath}: ${error}`) + }, + ) + }) + .then(undefined, (error: Error) => { + console.error(`[TerminalRegistry] Error creating temporary directory at ${tmpDir}: ${error}`) + }) + + return tmpDir + } + + /** + * Clean up a temporary directory used for ZDOTDIR + */ + private static zshCleanupTmpDir(terminalId: number): boolean { + const tmpDir = this.terminalTmpDirs.get(terminalId) + if (!tmpDir) { + return false + } + + const logPrefix = `[TerminalRegistry] Cleaning up temporary directory for terminal ${terminalId}` + console.info(`${logPrefix}: ${tmpDir}`) + + try { + // Use fs to remove the directory and its contents + const fs = require("fs") + const path = require("path") + + // Remove .zshrc file + const zshrcPath = path.join(tmpDir, ".zshrc") + if (fs.existsSync(zshrcPath)) { + console.info(`${logPrefix}: Removing .zshrc file at ${zshrcPath}`) + fs.unlinkSync(zshrcPath) + } + + // Remove the directory + if (fs.existsSync(tmpDir)) { + console.info(`${logPrefix}: Removing directory at ${tmpDir}`) + fs.rmdirSync(tmpDir) + } + + // Remove it from the map + this.terminalTmpDirs.delete(terminalId) + console.info(`${logPrefix}: Removed terminal ${terminalId} from temporary directory map`) + + return true + } catch (error: unknown) { + console.error( + `[TerminalRegistry] Error cleaning up temporary directory ${tmpDir}: ${error instanceof Error ? error.message : String(error)}`, + ) + return false + } + } + /** * Releases all terminals associated with a task * @param taskId The task ID diff --git a/src/integrations/terminal/__tests__/TerminalProcessExec.bash.test.ts b/src/integrations/terminal/__tests__/TerminalProcessExec.bash.test.ts index ace4ee2ec1b..109203c5991 100644 --- a/src/integrations/terminal/__tests__/TerminalProcessExec.bash.test.ts +++ b/src/integrations/terminal/__tests__/TerminalProcessExec.bash.test.ts @@ -11,6 +11,7 @@ jest.mock("vscode", () => { const eventHandlers = { startTerminalShellExecution: null, endTerminalShellExecution: null, + closeTerminal: null, } return { @@ -29,6 +30,10 @@ jest.mock("vscode", () => { eventHandlers.endTerminalShellExecution = handler return { dispose: jest.fn() } }), + onDidCloseTerminal: jest.fn().mockImplementation((handler) => { + eventHandlers.closeTerminal = handler + return { dispose: jest.fn() } + }), }, ThemeIcon: class ThemeIcon { constructor(id: string) { diff --git a/src/integrations/terminal/__tests__/TerminalProcessExec.cmd.test.ts b/src/integrations/terminal/__tests__/TerminalProcessExec.cmd.test.ts index c8be116b9f8..80d57da6176 100644 --- a/src/integrations/terminal/__tests__/TerminalProcessExec.cmd.test.ts +++ b/src/integrations/terminal/__tests__/TerminalProcessExec.cmd.test.ts @@ -16,6 +16,7 @@ jest.mock("vscode", () => { const eventHandlers = { startTerminalShellExecution: null, endTerminalShellExecution: null, + closeTerminal: null, } return { @@ -34,6 +35,10 @@ jest.mock("vscode", () => { eventHandlers.endTerminalShellExecution = handler return { dispose: jest.fn() } }), + onDidCloseTerminal: jest.fn().mockImplementation((handler) => { + eventHandlers.closeTerminal = handler + return { dispose: jest.fn() } + }), }, ThemeIcon: class ThemeIcon { constructor(id: string) { diff --git a/src/integrations/terminal/__tests__/TerminalProcessExec.pwsh.test.ts b/src/integrations/terminal/__tests__/TerminalProcessExec.pwsh.test.ts index 01c5b8d7fbd..3294d1198ee 100644 --- a/src/integrations/terminal/__tests__/TerminalProcessExec.pwsh.test.ts +++ b/src/integrations/terminal/__tests__/TerminalProcessExec.pwsh.test.ts @@ -17,6 +17,7 @@ jest.mock("vscode", () => { const eventHandlers = { startTerminalShellExecution: null, endTerminalShellExecution: null, + closeTerminal: null, } return { @@ -35,6 +36,10 @@ jest.mock("vscode", () => { eventHandlers.endTerminalShellExecution = handler return { dispose: jest.fn() } }), + onDidCloseTerminal: jest.fn().mockImplementation((handler) => { + eventHandlers.closeTerminal = handler + return { dispose: jest.fn() } + }), }, ThemeIcon: class ThemeIcon { constructor(id: string) { diff --git a/src/integrations/terminal/__tests__/TerminalRegistry.test.ts b/src/integrations/terminal/__tests__/TerminalRegistry.test.ts index d80087cc9c7..e813b9ba466 100644 --- a/src/integrations/terminal/__tests__/TerminalRegistry.test.ts +++ b/src/integrations/terminal/__tests__/TerminalRegistry.test.ts @@ -13,6 +13,7 @@ jest.mock("vscode", () => ({ exitStatus: undefined, } }, + onDidCloseTerminal: jest.fn().mockReturnValue({ dispose: jest.fn() }), }, ThemeIcon: jest.fn(), })) diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 03834fdcf93..8bd04f82282 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -537,6 +537,7 @@ export const globalSettingsSchema = z.object({ terminalZshClearEolMark: z.boolean().optional(), terminalZshOhMy: z.boolean().optional(), terminalZshP10k: z.boolean().optional(), + terminalZdotdir: z.boolean().optional(), rateLimitSeconds: z.number().optional(), diffEnabled: z.boolean().optional(), @@ -612,6 +613,7 @@ const globalSettingsRecord: GlobalSettingsRecord = { terminalZshClearEolMark: undefined, terminalZshOhMy: undefined, terminalZshP10k: undefined, + terminalZdotdir: undefined, rateLimitSeconds: undefined, diffEnabled: undefined, diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 1c978e1b98d..4fd8ccf2884 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -158,6 +158,7 @@ export type ExtensionState = Pick< | "terminalZshClearEolMark" | "terminalZshOhMy" | "terminalZshP10k" + | "terminalZdotdir" | "diffEnabled" | "fuzzyMatchThreshold" // | "experiments" // Optional in GlobalSettings, required here. diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index 987c6ef0eeb..93b69447397 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -87,6 +87,7 @@ export interface WebviewMessage { | "terminalZshClearEolMark" | "terminalZshOhMy" | "terminalZshP10k" + | "terminalZdotdir" | "mcpEnabled" | "enableMcpServerCreation" | "searchCommits" diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 16a6d29acba..c8b24e0dcd5 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -134,6 +134,7 @@ const SettingsView = forwardRef(({ onDone, t terminalZshClearEolMark, terminalZshOhMy, terminalZshP10k, + terminalZdotdir, writeDelayMs, showRooIgnoredFiles, remoteBrowserEnabled, @@ -247,6 +248,7 @@ const SettingsView = forwardRef(({ onDone, t vscode.postMessage({ type: "terminalZshClearEolMark", bool: terminalZshClearEolMark }) vscode.postMessage({ type: "terminalZshOhMy", bool: terminalZshOhMy }) vscode.postMessage({ type: "terminalZshP10k", bool: terminalZshP10k }) + vscode.postMessage({ type: "terminalZdotdir", bool: terminalZdotdir }) vscode.postMessage({ type: "mcpEnabled", bool: mcpEnabled }) vscode.postMessage({ type: "alwaysApproveResubmit", bool: alwaysApproveResubmit }) vscode.postMessage({ type: "requestDelaySeconds", value: requestDelaySeconds }) @@ -496,6 +498,7 @@ const SettingsView = forwardRef(({ onDone, t terminalZshClearEolMark={terminalZshClearEolMark} terminalZshOhMy={terminalZshOhMy} terminalZshP10k={terminalZshP10k} + terminalZdotdir={terminalZdotdir} setCachedStateField={setCachedStateField} /> diff --git a/webview-ui/src/components/settings/TerminalSettings.tsx b/webview-ui/src/components/settings/TerminalSettings.tsx index 0b97ca1ee3a..d4e2d8850d5 100644 --- a/webview-ui/src/components/settings/TerminalSettings.tsx +++ b/webview-ui/src/components/settings/TerminalSettings.tsx @@ -18,6 +18,7 @@ type TerminalSettingsProps = HTMLAttributes & { terminalZshClearEolMark?: boolean terminalZshOhMy?: boolean terminalZshP10k?: boolean + terminalZdotdir?: boolean setCachedStateField: SetCachedStateField< | "terminalOutputLineLimit" | "terminalShellIntegrationTimeout" @@ -26,6 +27,7 @@ type TerminalSettingsProps = HTMLAttributes & { | "terminalZshClearEolMark" | "terminalZshOhMy" | "terminalZshP10k" + | "terminalZdotdir" > } @@ -37,6 +39,7 @@ export const TerminalSettings = ({ terminalZshClearEolMark, terminalZshOhMy, terminalZshP10k, + terminalZdotdir, setCachedStateField, className, ...props @@ -161,6 +164,18 @@ export const TerminalSettings = ({ {t("settings:terminal.zshP10k.description")} + +
+ setCachedStateField("terminalZdotdir", e.target.checked)} + data-testid="terminal-zdotdir-checkbox"> + {t("settings:terminal.zdotdir.label")} + +
+ {t("settings:terminal.zdotdir.description")} +
+
) diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index a4dc2eca9a8..4b42a0fa389 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -39,6 +39,8 @@ export interface ExtensionStateContextType extends ExtensionState { setSoundVolume: (value: number) => void terminalShellIntegrationTimeout?: number setTerminalShellIntegrationTimeout: (value: number) => void + terminalZdotdir?: boolean + setTerminalZdotdir: (value: boolean) => void setTtsEnabled: (value: boolean) => void setTtsSpeed: (value: number) => void setDiffEnabled: (value: boolean) => void @@ -160,6 +162,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode pinnedApiConfigs: {}, // Empty object for pinned API configs terminalZshOhMy: false, // Default Oh My Zsh integration setting terminalZshP10k: false, // Default Powerlevel10k integration setting + terminalZdotdir: false, // Default ZDOTDIR handling setting }) const [didHydrateState, setDidHydrateState] = useState(false) @@ -289,6 +292,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode setState((prevState) => ({ ...prevState, terminalOutputLineLimit: value })), setTerminalShellIntegrationTimeout: (value) => setState((prevState) => ({ ...prevState, terminalShellIntegrationTimeout: value })), + setTerminalZdotdir: (value) => setState((prevState) => ({ ...prevState, terminalZdotdir: value })), setMcpEnabled: (value) => setState((prevState) => ({ ...prevState, mcpEnabled: value })), setEnableMcpServerCreation: (value) => setState((prevState) => ({ ...prevState, enableMcpServerCreation: value })), diff --git a/webview-ui/src/i18n/locales/ca/settings.json b/webview-ui/src/i18n/locales/ca/settings.json index eba65bd3c99..390362f099b 100644 --- a/webview-ui/src/i18n/locales/ca/settings.json +++ b/webview-ui/src/i18n/locales/ca/settings.json @@ -302,6 +302,10 @@ "label": "Temps d'espera d'integració de shell del terminal", "description": "Temps màxim d'espera per a la inicialització de la integració de shell abans d'executar comandes. Per a usuaris amb temps d'inici de shell llargs, aquest valor pot necessitar ser augmentat si veieu errors \"Shell Integration Unavailable\" al terminal." }, + "zdotdir": { + "label": "Habilitar gestió de ZDOTDIR", + "description": "Quan està habilitat, crea un directori temporal per a ZDOTDIR per gestionar correctament la integració del shell zsh. Això assegura que la integració del shell de VSCode funcioni correctament amb zsh mentre es preserva la teva configuració de zsh. (experimental)" + }, "commandDelay": { "label": "Retard de comanda del terminal", "description": "Retard en mil·lisegons a afegir després de l'execució de la comanda. La configuració predeterminada de 0 desactiva completament el retard. Això pot ajudar a assegurar que la sortida de la comanda es capturi completament en terminals amb problemes de temporització. En la majoria de terminals s'implementa establint `PROMPT_COMMAND='sleep N'` i Powershell afegeix `start-sleep` al final de cada comanda. Originalment era una solució per al error VSCode#237208 i pot no ser necessari." diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index 4147623f0a3..59ea1f6f1ea 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -302,6 +302,10 @@ "label": "Terminal-Shell-Integrationszeit-Limit", "description": "Maximale Wartezeit für die Shell-Integration, bevor Befehle ausgeführt werden. Für Benutzer mit langen Shell-Startzeiten musst du diesen Wert möglicherweise erhöhen, wenn du Fehler vom Typ \"Shell Integration Unavailable\" im Terminal siehst." }, + "zdotdir": { + "label": "ZDOTDIR-Behandlung aktivieren", + "description": "Erstellt bei Aktivierung ein temporäres Verzeichnis für ZDOTDIR, um die zsh-Shell-Integration korrekt zu handhaben. Dies stellt sicher, dass die VSCode-Shell-Integration mit zsh funktioniert und dabei deine zsh-Konfiguration erhalten bleibt. (experimentell)" + }, "commandDelay": { "label": "Terminal-Befehlsverzögerung", "description": "Verzögerung in Millisekunden, die nach der Befehlsausführung hinzugefügt wird. Die Standardeinstellung von 0 deaktiviert die Verzögerung vollständig. Dies kann dazu beitragen, dass die Befehlsausgabe in Terminals mit Timing-Problemen vollständig erfasst wird. In den meisten Terminals wird dies durch Setzen von `PROMPT_COMMAND='sleep N'` implementiert, und Powershell fügt `start-sleep` am Ende jedes Befehls hinzu. Ursprünglich war dies eine Lösung für VSCode-Bug#237208 und ist möglicherweise nicht mehr erforderlich." diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index 70955c932b3..5ba66f34e27 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -321,6 +321,10 @@ "zshP10k": { "label": "Enable Powerlevel10k integration", "description": "When enabled, sets POWERLEVEL9K_TERM_SHELL_INTEGRATION=true to enable Powerlevel10k shell integration features. (experimental)" + }, + "zdotdir": { + "label": "Enable ZDOTDIR handling", + "description": "When enabled, creates a temporary directory for ZDOTDIR to handle zsh shell integration properly. This ensures VSCode shell integration works correctly with zsh while preserving your zsh configuration. (experimental)" } }, "advanced": { diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index 744a91a8438..256c4d73f3b 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -302,6 +302,10 @@ "label": "Tiempo de espera de integración del shell del terminal", "description": "Tiempo máximo de espera para la inicialización de la integración del shell antes de ejecutar comandos. Para usuarios con tiempos de inicio de shell largos, este valor puede necesitar ser aumentado si ve errores \"Shell Integration Unavailable\" en el terminal." }, + "zdotdir": { + "label": "Habilitar gestión de ZDOTDIR", + "description": "Cuando está habilitado, crea un directorio temporal para ZDOTDIR para manejar correctamente la integración del shell zsh. Esto asegura que la integración del shell de VSCode funcione correctamente con zsh mientras preserva tu configuración de zsh. (experimental)" + }, "commandDelay": { "label": "Retraso de comando del terminal", "description": "Retraso en milisegundos para añadir después de la ejecución del comando. La configuración predeterminada de 0 desactiva completamente el retraso. Esto puede ayudar a asegurar que la salida del comando se capture completamente en terminales con problemas de temporización. En la mayoría de terminales se implementa estableciendo `PROMPT_COMMAND='sleep N'` y Powershell añade `start-sleep` al final de cada comando. Originalmente era una solución para el error VSCode#237208 y puede no ser necesario." diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index eabb55aca17..23d99a057d4 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -302,6 +302,10 @@ "label": "Délai d'intégration du shell du terminal", "description": "Temps maximum d'attente pour l'initialisation de l'intégration du shell avant d'exécuter des commandes. Pour les utilisateurs avec des temps de démarrage de shell longs, cette valeur peut nécessiter d'être augmentée si vous voyez des erreurs \"Shell Integration Unavailable\" dans le terminal." }, + "zdotdir": { + "label": "Activer la gestion ZDOTDIR", + "description": "Lorsque activé, crée un répertoire temporaire pour ZDOTDIR afin de gérer correctement l'intégration du shell zsh. Cela garantit le bon fonctionnement de l'intégration du shell VSCode avec zsh tout en préservant votre configuration zsh. (expérimental)" + }, "commandDelay": { "label": "Délai de commande du terminal", "description": "Délai en millisecondes à ajouter après l'exécution de la commande. Le paramètre par défaut de 0 désactive complètement le délai. Cela peut aider à garantir que la sortie de la commande est entièrement capturée dans les terminaux avec des problèmes de synchronisation. Dans la plupart des terminaux, cela est implémenté en définissant `PROMPT_COMMAND='sleep N'` et Powershell ajoute `start-sleep` à la fin de chaque commande. À l'origine, c'était une solution pour le bug VSCode#237208 et peut ne pas être nécessaire." diff --git a/webview-ui/src/i18n/locales/hi/settings.json b/webview-ui/src/i18n/locales/hi/settings.json index b8ae551287c..59556718c11 100644 --- a/webview-ui/src/i18n/locales/hi/settings.json +++ b/webview-ui/src/i18n/locales/hi/settings.json @@ -302,6 +302,10 @@ "label": "टर्मिनल शेल एकीकरण टाइमआउट", "description": "कमांड निष्पादित करने से पहले शेल एकीकरण के आरंभ होने के लिए प्रतीक्षा का अधिकतम समय। लंबे शेल स्टार्टअप समय वाले उपयोगकर्ताओं के लिए, यदि आप टर्मिनल में \"Shell Integration Unavailable\" त्रुटियाँ देखते हैं तो इस मान को बढ़ाने की आवश्यकता हो सकती है।" }, + "zdotdir": { + "label": "ZDOTDIR प्रबंधन सक्षम करें", + "description": "सक्षम होने पर, zsh शेल एकीकरण को सही ढंग से संभालने के लिए ZDOTDIR के लिए एक अस्थायी डायरेक्टरी बनाता है। यह आपके zsh कॉन्फ़िगरेशन को बनाए रखते हुए VSCode शेल एकीकरण को zsh के साथ सही ढंग से काम करने की सुनिश्चितता करता है। (प्रयोगात्मक)" + }, "commandDelay": { "label": "टर्मिनल कमांड विलंब", "description": "कमांड निष्पादन के बाद जोड़ने के लिए मिलीसेकंड में विलंब। 0 का डिफ़ॉल्ट सेटिंग विलंब को पूरी तरह से अक्षम कर देता है। यह टाइमिंग समस्याओं वाले टर्मिनलों में कमांड आउटपुट को पूरी तरह से कैप्चर करने में मदद कर सकता है। अधिकांश टर्मिनलों में यह `PROMPT_COMMAND='sleep N'` सेट करके कार्यान्वित किया जाता है और Powershell प्रत्येक कमांड के अंत में `start-sleep` जोड़ता है। मूल रूप से यह VSCode बग#237208 के लिए एक समाधान था और इसकी आवश्यकता नहीं हो सकती है।" diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index 3cade75da0a..30340b5e29a 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -302,6 +302,10 @@ "label": "Timeout integrazione shell del terminale", "description": "Tempo massimo di attesa per l'inizializzazione dell'integrazione della shell prima di eseguire i comandi. Per gli utenti con tempi di avvio della shell lunghi, questo valore potrebbe dover essere aumentato se si vedono errori \"Shell Integration Unavailable\" nel terminale." }, + "zdotdir": { + "label": "Abilita gestione ZDOTDIR", + "description": "Quando abilitato, crea una directory temporanea per ZDOTDIR per gestire correttamente l'integrazione della shell zsh. Questo assicura che l'integrazione della shell VSCode funzioni correttamente con zsh mantenendo la tua configurazione zsh. (sperimentale)" + }, "commandDelay": { "label": "Ritardo comando terminale", "description": "Ritardo in millisecondi da aggiungere dopo l'esecuzione del comando. L'impostazione predefinita di 0 disabilita completamente il ritardo. Questo può aiutare a garantire che l'output del comando sia catturato completamente nei terminali con problemi di temporizzazione. Nella maggior parte dei terminali viene implementato impostando `PROMPT_COMMAND='sleep N'` e Powershell aggiunge `start-sleep` alla fine di ogni comando. In origine era una soluzione per il bug VSCode#237208 e potrebbe non essere necessario." diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index 06a49e161db..03e2838d091 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -302,6 +302,10 @@ "label": "ターミナルシェル統合タイムアウト", "description": "コマンドを実行する前にシェル統合の初期化を待つ最大時間。シェルの起動時間が長いユーザーの場合、ターミナルで「Shell Integration Unavailable」エラーが表示される場合は、この値を増やす必要があるかもしれません。" }, + "zdotdir": { + "label": "ZDOTDIR 処理を有効化", + "description": "有効にすると、zsh シェル統合を適切に処理するために ZDOTDIR 用の一時ディレクトリを作成します。これにより、zsh の設定を保持しながら VSCode のシェル統合が正しく機能します。(実験的)" + }, "commandDelay": { "label": "ターミナルコマンド遅延", "description": "コマンド実行後に追加する遅延時間(ミリ秒)。デフォルト設定の0は遅延を完全に無効にします。これはタイミングの問題があるターミナルでコマンド出力を完全にキャプチャするのに役立ちます。ほとんどのターミナルでは`PROMPT_COMMAND='sleep N'`を設定することで実装され、PowerShellは各コマンドの最後に`start-sleep`を追加します。元々はVSCodeバグ#237208の回避策で、必要ない場合があります。" diff --git a/webview-ui/src/i18n/locales/ko/settings.json b/webview-ui/src/i18n/locales/ko/settings.json index 5461f32907d..b31df80304e 100644 --- a/webview-ui/src/i18n/locales/ko/settings.json +++ b/webview-ui/src/i18n/locales/ko/settings.json @@ -302,6 +302,10 @@ "label": "터미널 쉘 통합 타임아웃", "description": "명령을 실행하기 전에 쉘 통합이 초기화될 때까지 기다리는 최대 시간. 쉘 시작 시간이 긴 사용자의 경우, 터미널에서 \"Shell Integration Unavailable\" 오류가 표시되면 이 값을 늘려야 할 수 있습니다." }, + "zdotdir": { + "label": "ZDOTDIR 처리 활성화", + "description": "활성화하면 zsh 셸 통합을 올바르게 처리하기 위한 ZDOTDIR용 임시 디렉터리를 생성합니다. 이를 통해 zsh 구성을 유지하면서 VSCode 셸 통합이 zsh와 올바르게 작동합니다. (실험적)" + }, "commandDelay": { "label": "터미널 명령 지연", "description": "명령 실행 후 추가할 지연 시간(밀리초). 기본값 0은 지연을 완전히 비활성화합니다. 이는 타이밍 문제가 있는 터미널에서 명령 출력을 완전히 캡처하는 데 도움이 될 수 있습니다. 대부분의 터미널에서는 `PROMPT_COMMAND='sleep N'`을 설정하여 구현되며, PowerShell은 각 명령 끝에 `start-sleep`을 추가합니다. 원래는 VSCode 버그#237208에 대한 해결책이었으며 필요하지 않을 수 있습니다." diff --git a/webview-ui/src/i18n/locales/pl/settings.json b/webview-ui/src/i18n/locales/pl/settings.json index 28d718bc5a5..7f12e21360a 100644 --- a/webview-ui/src/i18n/locales/pl/settings.json +++ b/webview-ui/src/i18n/locales/pl/settings.json @@ -302,6 +302,10 @@ "label": "Limit czasu integracji powłoki terminala", "description": "Maksymalny czas oczekiwania na inicjalizację integracji powłoki przed wykonaniem poleceń. Dla użytkowników z długim czasem uruchamiania powłoki, ta wartość może wymagać zwiększenia, jeśli widzisz błędy \"Shell Integration Unavailable\" w terminalu." }, + "zdotdir": { + "label": "Włącz obsługę ZDOTDIR", + "description": "Po włączeniu tworzy tymczasowy katalog dla ZDOTDIR, aby poprawnie obsłużyć integrację powłoki zsh. Zapewnia to prawidłowe działanie integracji powłoki VSCode z zsh, zachowując twoją konfigurację zsh. (eksperymentalne)" + }, "commandDelay": { "label": "Opóźnienie poleceń terminala", "description": "Opóźnienie w milisekundach dodawane po wykonaniu polecenia. Domyślne ustawienie 0 całkowicie wyłącza opóźnienie. Może to pomóc w zapewnieniu pełnego przechwytywania wyjścia poleceń w terminalach z problemami z synchronizacją. W większości terminali jest to implementowane przez ustawienie `PROMPT_COMMAND='sleep N'`, a PowerShell dodaje `start-sleep` na końcu każdego polecenia. Pierwotnie było to obejście błędu VSCode#237208 i może nie być potrzebne." diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index e1bdb000152..c19a832a57d 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -302,6 +302,10 @@ "label": "Tempo limite de integração do shell do terminal", "description": "Tempo máximo de espera para a inicialização da integração do shell antes de executar comandos. Para usuários com tempos de inicialização de shell longos, este valor pode precisar ser aumentado se você vir erros \"Shell Integration Unavailable\" no terminal." }, + "zdotdir": { + "label": "Ativar gerenciamento do ZDOTDIR", + "description": "Quando ativado, cria um diretório temporário para o ZDOTDIR para lidar corretamente com a integração do shell zsh. Isso garante que a integração do shell do VSCode funcione corretamente com o zsh enquanto preserva sua configuração do zsh. (experimental)" + }, "commandDelay": { "label": "Atraso de comando do terminal", "description": "Atraso em milissegundos para adicionar após a execução do comando. A configuração padrão de 0 desativa completamente o atraso. Isso pode ajudar a garantir que a saída do comando seja totalmente capturada em terminais com problemas de temporização. Na maioria dos terminais, isso é implementado definindo `PROMPT_COMMAND='sleep N'` e o PowerShell adiciona `start-sleep` ao final de cada comando. Originalmente era uma solução para o bug VSCode#237208 e pode não ser necessário." diff --git a/webview-ui/src/i18n/locales/tr/settings.json b/webview-ui/src/i18n/locales/tr/settings.json index 14c147cc481..9ad9fedc880 100644 --- a/webview-ui/src/i18n/locales/tr/settings.json +++ b/webview-ui/src/i18n/locales/tr/settings.json @@ -302,6 +302,10 @@ "label": "Terminal kabuk entegrasyonu zaman aşımı", "description": "Komutları yürütmeden önce kabuk entegrasyonunun başlatılması için beklenecek maksimum süre. Kabuk başlatma süresi uzun olan kullanıcılar için, terminalde \"Shell Integration Unavailable\" hatalarını görürseniz bu değerin artırılması gerekebilir." }, + "zdotdir": { + "label": "ZDOTDIR işlemeyi etkinleştir", + "description": "Etkinleştirildiğinde, zsh kabuğu entegrasyonunu düzgün şekilde işlemek için ZDOTDIR için geçici bir dizin oluşturur. Bu, zsh yapılandırmanızı korurken VSCode kabuk entegrasyonunun zsh ile düzgün çalışmasını sağlar. (deneysel)" + }, "commandDelay": { "label": "Terminal komut gecikmesi", "description": "Komut yürütmesinden sonra eklenecek gecikme süresi (milisaniye). 0 varsayılan ayarı gecikmeyi tamamen devre dışı bırakır. Bu, zamanlama sorunları olan terminallerde komut çıktısının tam olarak yakalanmasını sağlamaya yardımcı olabilir. Çoğu terminalde bu, `PROMPT_COMMAND='sleep N'` ayarlanarak uygulanır ve PowerShell her komutun sonuna `start-sleep` ekler. Başlangıçta VSCode hata#237208 için bir geçici çözümdü ve gerekli olmayabilir." diff --git a/webview-ui/src/i18n/locales/vi/settings.json b/webview-ui/src/i18n/locales/vi/settings.json index 69f76bac138..24eb91d4a2e 100644 --- a/webview-ui/src/i18n/locales/vi/settings.json +++ b/webview-ui/src/i18n/locales/vi/settings.json @@ -302,6 +302,10 @@ "label": "Thời gian chờ tích hợp shell terminal", "description": "Thời gian tối đa để chờ tích hợp shell khởi tạo trước khi thực hiện lệnh. Đối với người dùng có thời gian khởi động shell dài, giá trị này có thể cần được tăng lên nếu bạn thấy lỗi \"Shell Integration Unavailable\" trong terminal." }, + "zdotdir": { + "label": "Bật xử lý ZDOTDIR", + "description": "Khi được bật, tạo thư mục tạm thời cho ZDOTDIR để xử lý tích hợp shell zsh một cách chính xác. Điều này đảm bảo tích hợp shell VSCode hoạt động chính xác với zsh trong khi vẫn giữ nguyên cấu hình zsh của bạn. (thử nghiệm)" + }, "commandDelay": { "label": "Độ trễ lệnh terminal", "description": "Độ trễ tính bằng mili giây để thêm vào sau khi thực hiện lệnh. Cài đặt mặc định là 0 sẽ tắt hoàn toàn độ trễ. Điều này có thể giúp đảm bảo đầu ra lệnh được ghi lại đầy đủ trong các terminal có vấn đề về thời gian. Trong hầu hết các terminal, điều này được thực hiện bằng cách đặt `PROMPT_COMMAND='sleep N'` và PowerShell thêm `start-sleep` vào cuối mỗi lệnh. Ban đầu là giải pháp cho lỗi VSCode#237208 và có thể không cần thiết." diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index 8d4f1ed5933..fd1919a5c31 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -302,6 +302,10 @@ "label": "终端初始化等待时间", "description": "执行命令前等待 Shell 集成初始化的最长时间。对于 Shell 启动时间较长的用户,如果在终端中看到\"Shell Integration Unavailable\"错误,可能需要增加此值。" }, + "zdotdir": { + "label": "启用 ZDOTDIR 处理", + "description": "启用后将创建临时目录用于 ZDOTDIR,以正确处理 zsh shell 集成。这确保 VSCode shell 集成能与 zsh 正常工作,同时保留您的 zsh 配置。(实验性)" + }, "commandDelay": { "label": "终端命令延迟", "description": "命令执行后添加的延迟时间(毫秒)。默认设置为 0 时完全禁用延迟。这可以帮助确保在有计时问题的终端中完全捕获命令输出。在大多数终端中,这是通过设置 `PROMPT_COMMAND='sleep N'` 实现的,而 PowerShell 会在每个命令末尾添加 `start-sleep`。最初是为了解决 VSCode 错误#237208,现在可能不再需要。" diff --git a/webview-ui/src/i18n/locales/zh-TW/settings.json b/webview-ui/src/i18n/locales/zh-TW/settings.json index d3e6dc9280e..baa4b614d86 100644 --- a/webview-ui/src/i18n/locales/zh-TW/settings.json +++ b/webview-ui/src/i18n/locales/zh-TW/settings.json @@ -302,6 +302,10 @@ "label": "終端機 Shell 整合逾時", "description": "執行命令前等待 Shell 整合初始化的最長時間。如果您的 Shell 啟動較慢,且終端機出現「Shell 整合無法使用」的錯誤訊息,可能需要提高此數值。" }, + "zdotdir": { + "label": "啟用 ZDOTDIR 處理", + "description": "啟用後將建立暫存目錄用於 ZDOTDIR,以正確處理 zsh shell 整合。這確保 VSCode shell 整合能與 zsh 正常運作,同時保留您的 zsh 設定。(實驗性)" + }, "commandDelay": { "label": "終端機命令延遲", "description": "命令執行後添加的延遲時間(毫秒)。預設值為 0 時完全停用延遲。這可以幫助確保在有計時問題的終端機中完整擷取命令輸出。在大多數終端機中,這是透過設定 `PROMPT_COMMAND='sleep N'` 實現的,而 PowerShell 會在每個命令結尾加入 `start-sleep`。最初是為了解決 VSCode 錯誤#237208,現在可能不再需要。" From ae0ab56654bec0a32601834754ff4348bb2bdda1 Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Fri, 11 Apr 2025 13:23:57 -0700 Subject: [PATCH 8/8] intl: enhance shell integration troubleshooting translations Add new i18n strings for shell integration steps and expand troubleshooting text across all supported languages Signed-off-by: Eric Wheeler --- webview-ui/src/components/chat/ChatRow.tsx | 12 +++++++++--- webview-ui/src/i18n/locales/ca/chat.json | 5 ++++- webview-ui/src/i18n/locales/de/chat.json | 5 ++++- webview-ui/src/i18n/locales/en/chat.json | 5 ++++- webview-ui/src/i18n/locales/es/chat.json | 5 ++++- webview-ui/src/i18n/locales/fr/chat.json | 5 ++++- webview-ui/src/i18n/locales/hi/chat.json | 5 ++++- webview-ui/src/i18n/locales/it/chat.json | 5 ++++- webview-ui/src/i18n/locales/ja/chat.json | 5 ++++- webview-ui/src/i18n/locales/ko/chat.json | 5 ++++- webview-ui/src/i18n/locales/pl/chat.json | 5 ++++- webview-ui/src/i18n/locales/pt-BR/chat.json | 5 ++++- webview-ui/src/i18n/locales/tr/chat.json | 5 ++++- webview-ui/src/i18n/locales/vi/chat.json | 5 ++++- webview-ui/src/i18n/locales/zh-CN/chat.json | 5 ++++- webview-ui/src/i18n/locales/zh-TW/chat.json | 5 ++++- 16 files changed, 69 insertions(+), 18 deletions(-) diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index aaa9f93e782..05005e46a1a 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -963,10 +963,16 @@ export const ChatRowContent = ({
{message.text}
+
+ • {t("chat:shellIntegration.checkSettings")} +
+ • {t("chat:shellIntegration.updateVSCode")} ( + CMD/CTRL + Shift + P → "Update") +
+ • {t("chat:shellIntegration.supportedShell")} ( + CMD/CTRL + Shift + P → "Terminal: Select Default Profile") +

- Please update VSCode (CMD/CTRL + Shift + P → "Update") and make sure - you're using a supported shell: zsh, bash, fish, or PowerShell ( - CMD/CTRL + Shift + P → "Terminal: Select Default Profile").{" "} diff --git a/webview-ui/src/i18n/locales/ca/chat.json b/webview-ui/src/i18n/locales/ca/chat.json index 6c913965d65..76f195f6373 100644 --- a/webview-ui/src/i18n/locales/ca/chat.json +++ b/webview-ui/src/i18n/locales/ca/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "Tasca completada", "shellIntegration": { "unavailable": "Integració de shell no disponible", - "troubleshooting": "Encara tens problemes?" + "troubleshooting": "Encara tens problemes? Fes clic aquí per a la documentació d'integració de shell.", + "checkSettings": "Comprova les solucions alternatives del terminal a la pàgina de configuració", + "updateVSCode": "Actualitza VSCode", + "supportedShell": "Assegura't d'utilitzar un shell compatible: zsh, bash, fish o PowerShell" }, "powershell": { "issues": "Sembla que estàs tenint problemes amb Windows PowerShell, si us plau consulta aquesta documentació per a més informació." diff --git a/webview-ui/src/i18n/locales/de/chat.json b/webview-ui/src/i18n/locales/de/chat.json index cb97b0bc842..302cccfe9cd 100644 --- a/webview-ui/src/i18n/locales/de/chat.json +++ b/webview-ui/src/i18n/locales/de/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "Aufgabe abgeschlossen", "shellIntegration": { "unavailable": "Shell-Integration nicht verfügbar", - "troubleshooting": "Immer noch Probleme?" + "troubleshooting": "Immer noch Probleme? Klicke hier für die Shell-Integrationsdokumentation.", + "checkSettings": "Überprüfe die Terminal-Workarounds in den Einstellungen", + "updateVSCode": "VSCode aktualisieren", + "supportedShell": "Stelle sicher, dass du eine unterstützte Shell verwendest: zsh, bash, fish oder PowerShell" }, "powershell": { "issues": "Es scheint, dass du Probleme mit Windows PowerShell hast, bitte sieh dir dies an" diff --git a/webview-ui/src/i18n/locales/en/chat.json b/webview-ui/src/i18n/locales/en/chat.json index f9f838356d8..efc492b7a6b 100644 --- a/webview-ui/src/i18n/locales/en/chat.json +++ b/webview-ui/src/i18n/locales/en/chat.json @@ -160,7 +160,10 @@ "troubleMessage": "Roo is having trouble...", "shellIntegration": { "unavailable": "Shell Integration Unavailable", - "troubleshooting": "Still having trouble?" + "troubleshooting": "Still having trouble? Click here for shell integration documentation.", + "checkSettings": "Check terminal workarounds in the settings page", + "updateVSCode": "Update VSCode", + "supportedShell": "Make sure you're using a supported shell: zsh, bash, fish, or PowerShell" }, "powershell": { "issues": "It seems like you're having Windows PowerShell issues, please see this" diff --git a/webview-ui/src/i18n/locales/es/chat.json b/webview-ui/src/i18n/locales/es/chat.json index caa1b6048ce..5e86247416a 100644 --- a/webview-ui/src/i18n/locales/es/chat.json +++ b/webview-ui/src/i18n/locales/es/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "Tarea completada", "shellIntegration": { "unavailable": "Integración de shell no disponible", - "troubleshooting": "¿Sigues teniendo problemas?" + "troubleshooting": "¿Sigues teniendo problemas? Haz clic aquí para ver la documentación de integración de shell.", + "checkSettings": "Revisa los ajustes alternativos de terminal en la página de configuración", + "updateVSCode": "Actualiza VSCode", + "supportedShell": "Asegúrate de usar un shell compatible: zsh, bash, fish o PowerShell" }, "powershell": { "issues": "Parece que estás teniendo problemas con Windows PowerShell, por favor consulta esta" diff --git a/webview-ui/src/i18n/locales/fr/chat.json b/webview-ui/src/i18n/locales/fr/chat.json index 28254ab1c82..36f8cbe2d4e 100644 --- a/webview-ui/src/i18n/locales/fr/chat.json +++ b/webview-ui/src/i18n/locales/fr/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "Tâche terminée", "shellIntegration": { "unavailable": "Intégration du shell indisponible", - "troubleshooting": "Toujours des problèmes ?" + "troubleshooting": "Toujours des problèmes ? Cliquez ici pour la documentation d'intégration du shell.", + "checkSettings": "Vérifie les solutions de contournement du terminal dans les paramètres", + "updateVSCode": "Mets à jour VSCode", + "supportedShell": "Assure-toi d'utiliser un shell supporté : zsh, bash, fish ou PowerShell" }, "powershell": { "issues": "Il semble que vous rencontriez des problèmes avec Windows PowerShell, veuillez consulter ce" diff --git a/webview-ui/src/i18n/locales/hi/chat.json b/webview-ui/src/i18n/locales/hi/chat.json index 78904af0062..9b68943eaeb 100644 --- a/webview-ui/src/i18n/locales/hi/chat.json +++ b/webview-ui/src/i18n/locales/hi/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "कार्य पूरा हुआ", "shellIntegration": { "unavailable": "शेल एकीकरण अनुपलब्ध", - "troubleshooting": "अभी भी समस्या है?" + "troubleshooting": "अभी भी समस्या है? शेल एकीकरण दस्तावेज़ के लिए यहाँ क्लिक करें।", + "checkSettings": "सेटिंग्स पेज में टर्मिनल वर्कअराउंड जांचें", + "updateVSCode": "VSCode अपडेट करें", + "supportedShell": "सुनिश्चित करें कि आप समर्थित शेल का उपयोग कर रहे हैं: zsh, bash, fish या PowerShell" }, "powershell": { "issues": "ऐसा लगता है कि आपको Windows PowerShell के साथ समस्याएँ हो रही हैं, कृपया इसे देखें" diff --git a/webview-ui/src/i18n/locales/it/chat.json b/webview-ui/src/i18n/locales/it/chat.json index cb1d5f6dc1a..b055c36b863 100644 --- a/webview-ui/src/i18n/locales/it/chat.json +++ b/webview-ui/src/i18n/locales/it/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "Attività completata", "shellIntegration": { "unavailable": "Integrazione shell non disponibile", - "troubleshooting": "Ancora problemi?" + "troubleshooting": "Ancora problemi? Clicca qui per la documentazione sull'integrazione della shell.", + "checkSettings": "Controlla le soluzioni alternative del terminale nella pagina delle impostazioni", + "updateVSCode": "Aggiorna VSCode", + "supportedShell": "Assicurati di utilizzare una shell supportata: zsh, bash, fish o PowerShell" }, "powershell": { "issues": "Sembra che tu stia avendo problemi con Windows PowerShell, consulta questa" diff --git a/webview-ui/src/i18n/locales/ja/chat.json b/webview-ui/src/i18n/locales/ja/chat.json index 4eb1aa52fe3..74250b70b95 100644 --- a/webview-ui/src/i18n/locales/ja/chat.json +++ b/webview-ui/src/i18n/locales/ja/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "タスク完了", "shellIntegration": { "unavailable": "シェル統合が利用できません", - "troubleshooting": "まだ問題がありますか?" + "troubleshooting": "まだ問題がありますか?シェル統合のドキュメントはこちらをクリックしてください。", + "checkSettings": "設定ページでターミナルの回避策を確認してください", + "updateVSCode": "VSCodeを更新してください", + "supportedShell": "サポートされているシェルを使用していることを確認してください:zsh、bash、fish、またはPowerShell" }, "powershell": { "issues": "Windows PowerShellに問題があるようです。こちらを参照してください" diff --git a/webview-ui/src/i18n/locales/ko/chat.json b/webview-ui/src/i18n/locales/ko/chat.json index 2f4bff5cd3a..037066f4896 100644 --- a/webview-ui/src/i18n/locales/ko/chat.json +++ b/webview-ui/src/i18n/locales/ko/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "작업 완료", "shellIntegration": { "unavailable": "쉘 통합 사용 불가", - "troubleshooting": "여전히 문제가 있나요?" + "troubleshooting": "여전히 문제가 있나요? 쉘 통합 문서를 보려면 여기를 클릭하세요.", + "checkSettings": "설정 페이지에서 터미널 해결 방법을 확인하세요", + "updateVSCode": "VSCode를 업데이트하세요", + "supportedShell": "지원되는 쉘을 사용하고 있는지 확인하세요: zsh, bash, fish 또는 PowerShell" }, "powershell": { "issues": "Windows PowerShell에 문제가 있는 것 같습니다. 다음을 참조하세요" diff --git a/webview-ui/src/i18n/locales/pl/chat.json b/webview-ui/src/i18n/locales/pl/chat.json index 372b3479430..8e6d74669e6 100644 --- a/webview-ui/src/i18n/locales/pl/chat.json +++ b/webview-ui/src/i18n/locales/pl/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "Zadanie zakończone", "shellIntegration": { "unavailable": "Integracja powłoki niedostępna", - "troubleshooting": "Nadal masz problemy?" + "troubleshooting": "Nadal masz problemy? Kliknij tutaj, aby zobaczyć dokumentację integracji powłoki.", + "checkSettings": "Sprawdź obejścia terminala na stronie ustawień", + "updateVSCode": "Zaktualizuj VSCode", + "supportedShell": "Upewnij się, że używasz obsługiwanej powłoki: zsh, bash, fish lub PowerShell" }, "powershell": { "issues": "Wygląda na to, że masz problemy z Windows PowerShell, proszę zapoznaj się z tym" diff --git a/webview-ui/src/i18n/locales/pt-BR/chat.json b/webview-ui/src/i18n/locales/pt-BR/chat.json index d5d7aefc565..bd50af503bf 100644 --- a/webview-ui/src/i18n/locales/pt-BR/chat.json +++ b/webview-ui/src/i18n/locales/pt-BR/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "Tarefa concluída", "shellIntegration": { "unavailable": "Integração de shell indisponível", - "troubleshooting": "Ainda com problemas?" + "troubleshooting": "Ainda com problemas? Clique aqui para ver a documentação de integração do shell.", + "checkSettings": "Verifique as soluções alternativas do terminal na página de configurações", + "updateVSCode": "Atualize o VSCode", + "supportedShell": "Certifique-se de estar usando um shell suportado: zsh, bash, fish ou PowerShell" }, "powershell": { "issues": "Parece que você está tendo problemas com o Windows PowerShell, por favor veja este" diff --git a/webview-ui/src/i18n/locales/tr/chat.json b/webview-ui/src/i18n/locales/tr/chat.json index 3e4d68d6183..baacb7e1d2a 100644 --- a/webview-ui/src/i18n/locales/tr/chat.json +++ b/webview-ui/src/i18n/locales/tr/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "Görev Tamamlandı", "shellIntegration": { "unavailable": "Kabuk Entegrasyonu Kullanılamıyor", - "troubleshooting": "Hala sorun mu yaşıyorsunuz?" + "troubleshooting": "Hala sorun mu yaşıyorsunuz? Kabuk entegrasyonu belgelerine göz atmak için buraya tıklayın.", + "checkSettings": "Ayarlar sayfasındaki terminal geçici çözümlerini kontrol et", + "updateVSCode": "VSCode'u güncelle", + "supportedShell": "Desteklenen bir kabuk kullandığından emin ol: zsh, bash, fish veya PowerShell" }, "powershell": { "issues": "Windows PowerShell ile ilgili sorunlar yaşıyor gibi görünüyorsunuz, lütfen şu konuya bakın" diff --git a/webview-ui/src/i18n/locales/vi/chat.json b/webview-ui/src/i18n/locales/vi/chat.json index 7c417d54ef0..021c4cd7308 100644 --- a/webview-ui/src/i18n/locales/vi/chat.json +++ b/webview-ui/src/i18n/locales/vi/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "Nhiệm vụ hoàn thành", "shellIntegration": { "unavailable": "Tích hợp shell không khả dụng", - "troubleshooting": "Vẫn gặp vấn đề?" + "troubleshooting": "Vẫn gặp vấn đề? Nhấp vào đây để xem tài liệu tích hợp shell.", + "checkSettings": "Kiểm tra các giải pháp thay thế cho terminal trong trang cài đặt", + "updateVSCode": "Cập nhật VSCode", + "supportedShell": "Đảm bảo bạn đang sử dụng shell được hỗ trợ: zsh, bash, fish hoặc PowerShell" }, "powershell": { "issues": "Có vẻ như bạn đang gặp vấn đề với Windows PowerShell, vui lòng xem" diff --git a/webview-ui/src/i18n/locales/zh-CN/chat.json b/webview-ui/src/i18n/locales/zh-CN/chat.json index a8c261642c1..52c15265dd1 100644 --- a/webview-ui/src/i18n/locales/zh-CN/chat.json +++ b/webview-ui/src/i18n/locales/zh-CN/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "任务完成", "shellIntegration": { "unavailable": "Shell集成不可用", - "troubleshooting": "仍有问题吗?" + "troubleshooting": "仍有问题吗?点击此处查看Shell集成文档。", + "checkSettings": "检查设置页面中的终端解决方案", + "updateVSCode": "更新VSCode", + "supportedShell": "确保使用受支持的shell:zsh、bash、fish或PowerShell" }, "powershell": { "issues": "看起来您遇到了Windows PowerShell问题,请参阅此" diff --git a/webview-ui/src/i18n/locales/zh-TW/chat.json b/webview-ui/src/i18n/locales/zh-TW/chat.json index b232eea8898..b28ce9e4ee0 100644 --- a/webview-ui/src/i18n/locales/zh-TW/chat.json +++ b/webview-ui/src/i18n/locales/zh-TW/chat.json @@ -160,7 +160,10 @@ "taskCompleted": "工作完成", "shellIntegration": { "unavailable": "Shell 整合功能無法使用", - "troubleshooting": "仍有問題嗎?" + "troubleshooting": "仍有問題嗎?點擊此處查看 Shell 整合文件。", + "checkSettings": "檢查設定頁面中的終端解決方案", + "updateVSCode": "更新 VSCode", + "supportedShell": "確保使用支援的 shell:zsh、bash、fish 或 PowerShell" }, "powershell": { "issues": "看起來您遇到了 Windows PowerShell 的問題,請參考此處"