Skip to content

Commit

Permalink
Allow elements that are set to skip formatting children to return ear…
Browse files Browse the repository at this point in the history
…ly from visitElement (#28)

Co-authored-by: Chayston Wood <[email protected]>
  • Loading branch information
chaystonwood and Chayston Wood authored Jan 30, 2024
1 parent 217d9ef commit df47cd9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/prettyprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export function format(src: string, indentation: number = 4, useSpaces: boolean
}

let visitor: Visitor = {
visitElement: function (element) {
visitElement: function (element, context: any) {
if (context.skipFormattingChildren) {
pretty.push(getFromSource(element.sourceSpan));
return;
}
if (pretty.length > 0) {
pretty.push('\n');
}
Expand Down

0 comments on commit df47cd9

Please sign in to comment.