diff --git a/src/data_model.rs b/src/data_model.rs index fae376a9..f3bf1c33 100644 --- a/src/data_model.rs +++ b/src/data_model.rs @@ -1818,7 +1818,7 @@ impl<'a> DocBuild<'a> for ConstructorBody { if c.has_trailing_newline { result.push(b.empty_new_line()); } else { - result.push(b.nl()); + result.push(b.indent(b.nl())); } } } else { diff --git a/tests/prettier80/bug92.cls b/tests/prettier80/bug92.cls new file mode 100644 index 00000000..c225f22f --- /dev/null +++ b/tests/prettier80/bug92.cls @@ -0,0 +1,8 @@ +// https://github.com/xixiaofinland/afmt/issues/92 +// the line after super() is not indented correctly; +class A { + public createEventProerties(String origin, String period) { + super(OriginSalesforce); + System.debug('hello'); + } +} diff --git a/tests/prettier80/bug92.in b/tests/prettier80/bug92.in new file mode 100644 index 00000000..c225f22f --- /dev/null +++ b/tests/prettier80/bug92.in @@ -0,0 +1,8 @@ +// https://github.com/xixiaofinland/afmt/issues/92 +// the line after super() is not indented correctly; +class A { + public createEventProerties(String origin, String period) { + super(OriginSalesforce); + System.debug('hello'); + } +}