Skip to content

Commit 54ef657

Browse files
committed
fix: Increase the indentation when inlining the first argument
1 parent 8011951 commit 54ef657

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/formatter.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,13 @@ impl<'a> Formatter<'a> {
301301
.max_inline_arguments
302302
.is_none_or(|limit| limit < self.indentation.span())
303303
{
304+
// We inlined something to the top level let's increase the indentation now
305+
if let Some((_, s)) = self.indentation.previous_top_level_reserved() {
306+
if !s.newline_after {
307+
self.indentation.increase_top_level(s.clone());
308+
}
309+
}
310+
304311
self.add_new_line(query);
305312
} else {
306313
self.trim_spaces_end(query);

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2477,7 +2477,7 @@ from
24772477
SELECT true
24782478
FROM bar
24792479
WHERE bar.foo = $99
2480-
AND bar.foo > $100
2480+
AND bar.foo > $100
24812481
),
24822482
c = CASE WHEN $6 THEN NULL ELSE COALESCE($7, c) END,
24832483
d = CASE

0 commit comments

Comments
 (0)