Skip to content

Commit

Permalink
Print angular control flow tokens with basic formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gergely-gyorgy-both committed Nov 13, 2023
1 parent 1867e24 commit 08ecdd3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions js/src/html/beautifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,12 @@ Beautifier.prototype._handle_control_flow_open = function(printer, raw_token) {
text: raw_token.text,
type: raw_token.type
};

printer.print_newline(true); // TODO: handle indentation based on brace_style (and preserve-inline)
printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);
if(raw_token.newlines) {
printer.print_preserved_newlines(raw_token);
} else {
printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);
}
printer.print_token(raw_token);
printer.indent();
return parser_token;
Expand All @@ -349,7 +353,11 @@ Beautifier.prototype._handle_control_flow_close = function(printer, raw_token) {
};

printer.deindent();
printer.print_newline(true);
if(raw_token.newlines) {
printer.print_preserved_newlines(raw_token);
} else {
printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);
}
printer.print_token(raw_token);
return parser_token;
};
Expand Down

0 comments on commit 08ecdd3

Please sign in to comment.