File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -490,30 +490,30 @@ export async function closeAllEditors(): Promise<void> {
490490 / a m a z o n w e b s e r v i c e s \. [ a - z \- ] + - v s c o d e \. / ,
491491 / n u l l E x t e n s i o n D e s c r i p t i o n ./ , // Sometimes exists instead of the prior line, see https://github.com/aws/aws-toolkit-vscode/issues/4658
492492 ]
493- const editors : vscode . TextEditor [ ] = [ ]
493+ const editorsToClose : vscode . TextEditor [ ] = [ ]
494494
495495 const noVisibleEditor : boolean | undefined = await waitUntil (
496496 async ( ) => {
497497 // Race: documents could appear after the call to closeAllEditors(), so retry.
498498 await vscode . commands . executeCommand ( closeAllCmd )
499- editors . length = 0
500- editors . push (
499+ editorsToClose . length = 0
500+ editorsToClose . push (
501501 ...vscode . window . visibleTextEditors . filter (
502502 ( editor ) => ! ignorePatterns . some ( ( p ) => p . test ( editor . document . fileName ) )
503503 )
504504 )
505505
506- return editors . length === 0
506+ return editorsToClose . length === 0
507507 } ,
508508 {
509- timeout : 5000 , // Arbitrary values. Should succeed except when VS Code is lagging heavily.
509+ timeout : 1000 , // Arbitrary values. Should succeed except when VS Code is lagging heavily.
510510 interval : 250 ,
511511 truthy : true ,
512512 }
513513 )
514514
515- if ( ! noVisibleEditor ) {
516- const editorNames = editors . map ( ( editor ) => `\t${ editor . document . fileName } ` )
515+ if ( ! noVisibleEditor && editorsToClose . length > 0 ) {
516+ const editorNames = editorsToClose . map ( ( editor ) => `\t${ editor . document . fileName } ` )
517517 throw new Error ( `Editors were still open after closeAllEditors():\n${ editorNames . join ( '\n' ) } ` )
518518 }
519519}
You can’t perform that action at this time.
0 commit comments