Closed regexident closed 4 weeks ago
Thanks for the suggestion. This is definitely an area where SQL Formatter lacks (among many things).
However, even when this feature gets implemented in SQL Formatter, it will likely never reach the plugin you're using, because it's no longer maintained. See the FAQ
This particular problem has been solved in prettier-plugin-sql-cst. Which is another SQL formatting tool I've written to overcome the fundamental shortcomings of SQL Formatter. It doesn't yet have full PostgreSQL support, but perhaps enough for your use.
Regarding implementing this in SQL Formatter.. well, I'm not really doing any new feature development in here. So the chances of it happening are pretty low.
Closing this as it's a duplicate of a very old feature request: #329
Input data
Which SQL and options did you provide as input?
I'm using the default settings of "Prettier SQL VSCode".
sql-formatter strips empty lines between line/block comment sections, fusing the sections together, which is highly undesirable if those comment sections are unrelated and just happen to not have any code in between them.
This behavior is particularly unfortunate for code that makes use of minimap section header comments like this:
… which get dissolved into whatever other comments happen to surround it, despite being clearly a separate "thing".
At the very least I would expect sql-formatter to expose a configuration option for preserving gaps between comment blocks.
Expected Output
Actual Output
Usage
In VSCode via the inferrinizzard.prettier-sql-vscode extension.
I'm using PGSQL, but it should apply to all supported dialects, I presume.
Whatever version shipped with Prettier SQL VSCode v1.6.0.