Fix printDocToString calls (#19983)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-09-04 17:25:02 +08:00
1 parent 7e4fe3157e
commit a1364d3c3b
2 files changed
+6 -1

No files matched your search

@@ -228,6 +228,7 @@ function printTemplateExpression(
const renderedExpression = printDocToString(expressionDoc, { const renderedExpression = printDocToString(expressionDoc, {
...options, ...options,
printWidth: Number.POSITIVE_INFINITY, printWidth: Number.POSITIVE_INFINITY,
endOfLine: "lf",
}).formatted; }).formatted;
// ... unless one will be introduced anyway, e.g. by a nested function. // ... unless one will be introduced anyway, e.g. by a nested function.
+5 -1
View File
@@ -16,7 +16,11 @@ function printTable(path, options, print) {
const contents = path.map( const contents = path.map(
() => () =>
path.map(({ index: columnIndex }) => { path.map(({ index: columnIndex }) => {
const text = printDocToString(print(), options).formatted; const text = printDocToString(print(), {
...options,
printWidth: Number.POSITIVE_INFINITY,
endOfLine: "lf",
}).formatted;
const width = getStringWidth(text); const width = getStringWidth(text);
columnMaxWidths[columnIndex] = Math.max( columnMaxWidths[columnIndex] = Math.max(
columnMaxWidths[columnIndex] ?? 3, // minimum width = 3 (---, :--, :-:, --:) columnMaxWidths[columnIndex] ?? 3, // minimum width = 3 (---, :--, :-:, --:)