Break nested calls (#517)

If there's a break inside of a call, we want to force it in the group, otherwise it may get the indentation wrong. See the real-world use case in #513

Fixes #513
This commit is contained in:
Christopher Chedeau authored and James Long committed 2017-01-31 11:45:47 -05:00
1 parent 8bc3c617a0
commit d3fa519492
4 files changed
+20 -1

No files matched your search

+2 -1
View File
@@ -1768,7 +1768,8 @@ function printArgumentsList(path, options, print) {
ifBreak(options.trailingComma ? "," : ""),
softline,
")"
])
]),
{ shouldBreak: printed.some(willBreak) }
);
}
@@ -0,0 +1,14 @@
exports[`test break.js 1`] = `
"h(f(g(() => {
a
})))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
h(
f(
g(() => {
a;
})
)
);
"
`;
+3
View File
@@ -0,0 +1,3 @@
h(f(g(() => {
a
})))
+1
View File
@@ -0,0 +1 @@
run_spec(__dirname);