File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { group } from "../../document/builders.js" ;
2- import { printAssignmentWithLayout } from "../../language-js/print/assignment.js" ;
1+ import { group , line , indent } from "../../document/builders.js" ;
32import { formatAttributeValue } from "./utils.js" ;
43
54export default async function printAngularLetDeclaration (
@@ -10,18 +9,17 @@ export default async function printAngularLetDeclaration(
109) {
1110 const { node } = path ;
1211
12+ const leftDoc = node . name ;
13+ const operator = " =" ;
1314 const rightDoc = await formatAttributeValue ( node . value , textToDoc , {
1415 parser : "__ng_binding" ,
1516 __isInHtmlAttribute : false ,
1617 } ) ;
17- const printed = printAssignmentWithLayout (
18- path ,
19- options ,
20- print ,
21- /* leftDoc */ node . name ,
22- /* operator */ " =" ,
23- rightDoc ,
24- "break-after-operator" ,
25- ) ;
26- return group ( [ "@let " , printed , ";" ] ) ;
18+ // print like "break-after-operator" layout assignment
19+ const printedAssignment = group ( [
20+ group ( leftDoc ) ,
21+ operator ,
22+ group ( indent ( [ line , rightDoc ] ) ) ,
23+ ] ) ;
24+ return group ( [ "@let " , printedAssignment , ";" ] ) ;
2725}
Original file line number Diff line number Diff line change @@ -43,26 +43,6 @@ function printAssignment(
4343 ? print ( rightPropertyName , { assignmentLayout : layout } )
4444 : "" ;
4545
46- return printAssignmentWithLayout (
47- path ,
48- options ,
49- print ,
50- leftDoc ,
51- operator ,
52- rightDoc ,
53- layout ,
54- ) ;
55- }
56-
57- function printAssignmentWithLayout (
58- path ,
59- options ,
60- print ,
61- leftDoc ,
62- operator ,
63- rightDoc ,
64- layout ,
65- ) {
6646 switch ( layout ) {
6747 // First break after operator, then the sides are broken independently on their own lines
6848 case "break-after-operator" :
@@ -491,6 +471,5 @@ export {
491471 isArrowFunctionVariableDeclarator ,
492472 printAssignment ,
493473 printAssignmentExpression ,
494- printAssignmentWithLayout ,
495474 printVariableDeclarator ,
496475} ;
You can’t perform that action at this time.
0 commit comments