sqlformat-rs icon indicating copy to clipboard operation
sqlformat-rs copied to clipboard

Add option to configure newline after keywords

Open bartlomieju opened this issue 11 months ago • 7 comments

A query like this:

SELECT * FROM users WHERE id = 1;

gets formatted as:

SELECT
  *
FROM
  users
WHERE
  id = 1;

Would it be possible to configure the formatter to only add newline if there is more than one item following a keyword?

So in another example I'd like to be able to format this:

SELECT * FROM users WHERE id = 1;

SELECT id, name, email, created_at FROM users WHERE id = 1;

into this:

SELECT * FROM users WHERE id = 1;

SELECT
  id,
  name,
  email,
  created_at
FROM users WHERE id = 1;
-- or this
SELECT
  id,
  name,
  email,
  created_at
FROM users
WHERE id = 1;

bartlomieju avatar Nov 14 '24 12:11 bartlomieju