Skip to content

Commit 324000a

Browse files
committed
fix: pass option to printer
1 parent 8eaf4a3 commit 324000a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/print/CallExpression.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88

99
const { group, softline, line, indent, join } = doc.builders;
1010

11-
const p = (node, path, print) => {
11+
const p = (node, path, print, options) => {
1212
node[EXPRESSION_NEEDED] = false;
1313
node[STRING_NEEDS_QUOTES] = true;
1414
const mappedArguments = path.map(print, "arguments");
@@ -22,6 +22,8 @@ const p = (node, path, print) => {
2222
// Optimization: No line break between "(" and "{" if
2323
// there is exactly one object parameter
2424
parts.push(mappedArguments[0], ")");
25+
} else if (options.experimentalMethodChainIndentation) {
26+
parts.push(indent([join([","], mappedArguments)]), ")");
2527
} else {
2628
parts.push(
2729
indent([softline, join([",", line], mappedArguments)]),

src/print/MemberExpression.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ import {
55
wrapExpressionIfNeeded
66
} from "../util/index.js";
77

8-
const { group } = doc.builders;
8+
const { group, softline, indent } = doc.builders;
99

10-
const p = (node, path, print) => {
10+
const p = (node, path, print, options) => {
1111
node[EXPRESSION_NEEDED] = false;
1212
node[STRING_NEEDS_QUOTES] = true;
1313
const parts = [path.call(print, "object")];
14-
parts.push(node.computed ? "[" : ".");
14+
if (node.computed) {
15+
parts.push("[");
16+
} else if (options.experimentalMethodChainIndentation) {
17+
parts.push(indent([softline, "."]));
18+
} else {
19+
parts.push(".");
20+
}
1521
parts.push(path.call(print, "property"));
1622
if (node.computed) {
1723
parts.push("]");

0 commit comments

Comments
 (0)