Просмотр исходного кода

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 <[email protected]>
Eric Wheeler 8 месяцев назад
Родитель
Сommit
211e31b8f6

+ 3 - 0
src/core/webview/ClineProvider.ts

@@ -1199,6 +1199,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
 			terminalOutputLineLimit,
 			terminalShellIntegrationTimeout,
 			terminalCommandDelay,
+			terminalPowershellCounter,
 			fuzzyMatchThreshold,
 			mcpEnabled,
 			enableMcpServerCreation,
@@ -1267,6 +1268,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> 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<ClineProviderEvents> 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,

+ 7 - 0
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

+ 1 - 0
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

+ 1 - 0
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

+ 17 - 0
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)
 	}

+ 7 - 2
src/integrations/terminal/TerminalProcess.ts

@@ -290,11 +290,16 @@ export class TerminalProcess extends EventEmitter<TerminalProcessEvents> {
 				(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)

+ 2 - 0
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,

+ 1 - 0
src/shared/ExtensionMessage.ts

@@ -154,6 +154,7 @@ export type ExtensionState = Pick<
 	| "terminalOutputLineLimit"
 	| "terminalShellIntegrationTimeout"
 	| "terminalCommandDelay"
+	| "terminalPowershellCounter"
 	| "diffEnabled"
 	| "fuzzyMatchThreshold"
 	// | "experiments" // Optional in GlobalSettings, required here.

+ 1 - 0
src/shared/WebviewMessage.ts

@@ -83,6 +83,7 @@ export interface WebviewMessage {
 		| "terminalOutputLineLimit"
 		| "terminalShellIntegrationTimeout"
 		| "terminalCommandDelay"
+		| "terminalPowershellCounter"
 		| "mcpEnabled"
 		| "enableMcpServerCreation"
 		| "searchCommits"

+ 3 - 0
webview-ui/src/components/settings/SettingsView.tsx

@@ -130,6 +130,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
 		terminalOutputLineLimit,
 		terminalShellIntegrationTimeout,
 		terminalCommandDelay,
+		terminalPowershellCounter,
 		writeDelayMs,
 		showRooIgnoredFiles,
 		remoteBrowserEnabled,
@@ -239,6 +240,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ 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<SettingsViewRef, SettingsViewProps>(({ onDone, t
 						terminalOutputLineLimit={terminalOutputLineLimit}
 						terminalShellIntegrationTimeout={terminalShellIntegrationTimeout}
 						terminalCommandDelay={terminalCommandDelay}
+						terminalPowershellCounter={terminalPowershellCounter}
 						setCachedStateField={setCachedStateField}
 					/>
 				</div>

+ 19 - 1
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<HTMLDivElement> & {
 	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")}
 					</div>
 				</div>
+
+				<div>
+					<VSCodeCheckbox
+						checked={terminalPowershellCounter ?? false}
+						onChange={(e: any) => setCachedStateField("terminalPowershellCounter", e.target.checked)}
+						data-testid="terminal-powershell-counter-checkbox">
+						<span className="font-medium">{t("settings:terminal.powershellCounter.label")}</span>
+					</VSCodeCheckbox>
+					<div className="text-vscode-descriptionForeground text-sm mt-1">
+						{t("settings:terminal.powershellCounter.description")}
+					</div>
+				</div>
 			</Section>
 		</div>
 	)

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {

+ 4 - 0
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": {