[Glimmer/Handlebars] Forces multilines print when almost at max length (#6249)
parent
0c72b24a0e
commit
b557dc3603
|
@ -174,7 +174,7 @@ function print(path, options, print) {
|
|||
return group(
|
||||
concat([
|
||||
n.escaped === false ? "{{{" : "{{",
|
||||
printPathParams(path, print),
|
||||
printPathParams(path, print, { group: false }),
|
||||
isConcat ? "" : softline,
|
||||
n.escaped === false ? "}}}" : "}}"
|
||||
])
|
||||
|
@ -358,12 +358,17 @@ function getParams(path, print) {
|
|||
return parts;
|
||||
}
|
||||
|
||||
function printPathParams(path, print) {
|
||||
function printPathParams(path, print, options) {
|
||||
let parts = [];
|
||||
options = Object.assign({ group: true }, options || {});
|
||||
|
||||
parts.push(printPath(path, print));
|
||||
parts = parts.concat(getParams(path, print));
|
||||
|
||||
if (!options.group) {
|
||||
return indent(join(line, parts));
|
||||
}
|
||||
|
||||
return indent(group(join(line, parts)));
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,26 @@ printWidth: 80
|
|||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`component.hbs 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["glimmer"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
{{my-component foo="bar" bar="baz" action=(action "almostTheMaximumLengthxxxxxx")}}
|
||||
|
||||
{{my-component foo="bar"}}
|
||||
|
||||
=====================================output=====================================
|
||||
{{my-component
|
||||
foo="bar"
|
||||
bar="baz"
|
||||
action=(action "almostTheMaximumLengthxxxxxx")
|
||||
}}
|
||||
{{my-component foo="bar"}}
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`each.hbs 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["glimmer"]
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{{my-component foo="bar" bar="baz" action=(action "almostTheMaximumLengthxxxxxx")}}
|
||||
|
||||
{{my-component foo="bar"}}
|
Loading…
Reference in New Issue