You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constDIFF_EDITOR_TIMEOUT=15_000// Increased from 10s to 15s to accommodate slower systems
489
+
constMAX_RETRIES=2// Allow up to 2 retries on timeout
489
490
491
+
letcurrentRetry=0
490
492
lettimeoutId: NodeJS.Timeout|undefined
491
-
constdisposables: vscode.Disposable[]=[]
493
+
letdisposables: vscode.Disposable[]=[]
494
+
letisResolved=false
492
495
493
496
constcleanup=()=>{
494
497
if(timeoutId){
@@ -499,77 +502,122 @@ export class DiffViewProvider {
499
502
disposables.length=0
500
503
}
501
504
502
-
// Set timeout for the entire operation
503
-
timeoutId=setTimeout(()=>{
504
-
cleanup()
505
-
reject(
506
-
newError(
507
-
`Failed to open diff editor for ${uri.fsPath} within ${DIFF_EDITOR_TIMEOUT/1000} seconds. The editor may be blocked or VS Code may be unresponsive.`,
508
-
),
505
+
constattemptOpenDiffEditor=()=>{
506
+
// Set timeout for the current attempt
507
+
timeoutId=setTimeout(()=>{
508
+
if(!isResolved){
509
+
cleanup()
510
+
511
+
// Try retrying if we haven't exceeded MAX_RETRIES
512
+
if(currentRetry<MAX_RETRIES){
513
+
currentRetry++
514
+
console.warn(
515
+
`[DiffViewProvider] Diff editor timeout for ${uri.fsPath}, retrying... (attempt ${currentRetry+1}/${MAX_RETRIES+1})`,
516
+
)
517
+
// Reset and retry
518
+
disposables=[]
519
+
attemptOpenDiffEditor()
520
+
}else{
521
+
// All retries exhausted
522
+
isResolved=true
523
+
reject(
524
+
newError(
525
+
`Failed to open diff editor for ${uri.fsPath} after ${MAX_RETRIES+1} attempts (${DIFF_EDITOR_TIMEOUT/1000}s timeout each). The editor may be blocked or VS Code may be unresponsive.`,
526
+
),
527
+
)
528
+
}
529
+
}
530
+
},DIFF_EDITOR_TIMEOUT)
531
+
532
+
// Listen for document open events - more efficient than scanning all tabs
0 commit comments