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
master
Christopher Chedeau 2017-01-31 08:45:47 -08:00 committed by James Long
parent 8bc3c617a0
commit d3fa519492
4 changed files with 20 additions and 1 deletions

View File

@ -1768,7 +1768,8 @@ function printArgumentsList(path, options, print) {
ifBreak(options.trailingComma ? "," : ""),
softline,
")"
])
]),
{ shouldBreak: printed.some(willBreak) }
);
}

View File

@ -0,0 +1,14 @@
exports[`test break.js 1`] = `
"h(f(g(() => {
a
})))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
h(
f(
g(() => {
a;
})
)
);
"
`;

View File

@ -0,0 +1,3 @@
h(f(g(() => {
a
})))

View File

@ -0,0 +1 @@
run_spec(__dirname);