Browse Source

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 <[email protected]>
Eric Wheeler 10 months ago
parent
commit
0b0c438284

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

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

@@ -254,12 +254,16 @@ export class TerminalProcess extends EventEmitter<TerminalProcessEvents> {
 					// 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<string>) => {