| 97 | } |
| 98 | |
| 99 | async function waitForFileToFinish(filePath: string): Promise<boolean | undefined> { |
| 100 | const fileBusy = true; |
| 101 | let currentSize = 0; |
| 102 | let previousSize = 1; |
| 103 | |
| 104 | while (fileBusy) { |
| 105 | const stats = statSync(filePath); |
| 106 | currentSize = stats.size; |
| 107 | |
| 108 | // UPDATE: We are now limited to 20 mb by MODEL_TOKENIZATION_LIMIT |
| 109 | // Https://github.com/Microsoft/vscode/blob/master/src/vs/editor/common/model/textModel.ts#L34 |
| 110 | if (currentSize > 2 * 10000000) { // 20 MB |
| 111 | return false; |
| 112 | } |
| 113 | |
| 114 | if (currentSize === previousSize) { |
| 115 | return true; |
| 116 | } |
| 117 | previousSize = currentSize; |
| 118 | await delay(50); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | function checkcsv(): boolean { |
| 123 | const iscsv = extensions.getExtension('GrapeCity.gc-excelviewer'); |