(timeout = 1_000)
| 71 | } |
| 72 | } |
| 73 | const closeWindowsImplementation = (timeout = 1_000) => { |
| 74 | return new Promise<void>((resolve, reject) => { |
| 75 | // Attempt to fix #1301. |
| 76 | // Lets not waste too much time. |
| 77 | const timer = setTimeout(() => reject(new CloseEditorsTimeoutError()), timeout); |
| 78 | vscode.commands.executeCommand('workbench.action.closeAllEditors').then( |
| 79 | () => { |
| 80 | clearTimeout(timer); |
| 81 | resolve(); |
| 82 | }, |
| 83 | (ex) => { |
| 84 | clearTimeout(timer); |
| 85 | reject(ex); |
| 86 | } |
| 87 | ); |
| 88 | }); |
| 89 | }; |
| 90 | |
| 91 | // For some reason some times the command times out. |
| 92 | // If this happens, just wait & retry, no idea why VS Code is flaky. |
no test coverage detected