mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.43k stars 290 forks source link

Newlines before comments are sometimes removed #1337

Open pangolingo opened 1 month ago

pangolingo commented 1 month ago

Describe the bug When formatting a Postgres SQL statement with a comment on its own line, the comment is placed at the end of the preceding line.

To Reproduce Paste this SQL statement into the online formatter playground at https://vscode-sqltools.mteixeira.dev/en/playground/formatter?umd_source=repository&utm_medium=readme&utm_campaign=formatter

SELECT * FROM my_table
-- test comment
WHERE x = 1;

Observe the result:

SELECT * FROM my_table -- test comment
WHERE x = 1;

Expected behavior The comment is kept on it's own line

Screenshots

Screen Shot 2024-05-22 at 12 26 53 PM