[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(
|
return group(
|
||||||
concat([
|
concat([
|
||||||
n.escaped === false ? "{{{" : "{{",
|
n.escaped === false ? "{{{" : "{{",
|
||||||
printPathParams(path, print),
|
printPathParams(path, print, { group: false }),
|
||||||
isConcat ? "" : softline,
|
isConcat ? "" : softline,
|
||||||
n.escaped === false ? "}}}" : "}}"
|
n.escaped === false ? "}}}" : "}}"
|
||||||
])
|
])
|
||||||
|
@ -358,12 +358,17 @@ function getParams(path, print) {
|
||||||
return parts;
|
return parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
function printPathParams(path, print) {
|
function printPathParams(path, print, options) {
|
||||||
let parts = [];
|
let parts = [];
|
||||||
|
options = Object.assign({ group: true }, options || {});
|
||||||
|
|
||||||
parts.push(printPath(path, print));
|
parts.push(printPath(path, print));
|
||||||
parts = parts.concat(getParams(path, print));
|
parts = parts.concat(getParams(path, print));
|
||||||
|
|
||||||
|
if (!options.group) {
|
||||||
|
return indent(join(line, parts));
|
||||||
|
}
|
||||||
|
|
||||||
return indent(group(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`] = `
|
exports[`each.hbs 1`] = `
|
||||||
====================================options=====================================
|
====================================options=====================================
|
||||||
parsers: ["glimmer"]
|
parsers: ["glimmer"]
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{{my-component foo="bar" bar="baz" action=(action "almostTheMaximumLengthxxxxxx")}}
|
||||||
|
|
||||||
|
{{my-component foo="bar"}}
|
Loading…
Reference in New Issue