(filesInError, host)
| 122830 | } |
| 122831 | ts.getErrorSummaryText = getErrorSummaryText; |
| 122832 | function createTabularErrorsDisplay(filesInError, host) { |
| 122833 | var distinctFiles = filesInError.filter(function (value, index, self) { return index === self.findIndex(function (file) { return (file === null || file === void 0 ? void 0 : file.fileName) === (value === null || value === void 0 ? void 0 : value.fileName); }); }); |
| 122834 | if (distinctFiles.length === 0) |
| 122835 | return ""; |
| 122836 | var numberLength = function (num) { return Math.log(num) * Math.LOG10E + 1; }; |
| 122837 | var fileToErrorCount = distinctFiles.map(function (file) { return [file, ts.countWhere(filesInError, function (fileInError) { return fileInError.fileName === file.fileName; })]; }); |
| 122838 | var maxErrors = fileToErrorCount.reduce(function (acc, value) { return Math.max(acc, value[1] || 0); }, 0); |
| 122839 | var headerRow = ts.Diagnostics.Errors_Files.message; |
| 122840 | var leftColumnHeadingLength = headerRow.split(" ")[0].length; |
| 122841 | var leftPaddingGoal = Math.max(leftColumnHeadingLength, numberLength(maxErrors)); |
| 122842 | var headerPadding = Math.max(numberLength(maxErrors) - leftColumnHeadingLength, 0); |
| 122843 | var tabularData = ""; |
| 122844 | tabularData += " ".repeat(headerPadding) + headerRow + "\n"; |
| 122845 | fileToErrorCount.forEach(function (row) { |
| 122846 | var file = row[0], errorCount = row[1]; |
| 122847 | var errorCountDigitsLength = Math.log(errorCount) * Math.LOG10E + 1 | 0; |
| 122848 | var leftPadding = errorCountDigitsLength < leftPaddingGoal ? |
| 122849 | " ".repeat(leftPaddingGoal - errorCountDigitsLength) |
| 122850 | : ""; |
| 122851 | var fileRef = prettyPathForFileError(file, host.getCurrentDirectory()); |
| 122852 | tabularData += "".concat(leftPadding).concat(errorCount, " ").concat(fileRef, "\n"); |
| 122853 | }); |
| 122854 | return tabularData; |
| 122855 | } |
| 122856 | function isBuilderProgram(program) { |
| 122857 | return !!program.getState; |
| 122858 | } |
no test coverage detected