-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prettier JOINs and other formatting improvements #92
base: 1.5.x
Are you sure you want to change the base?
Conversation
Thank you. This is a feature, so we should target the 1.2.x branch. 1.1.x is for bugfixes. |
There was a mention of breaking changes in the description. Can you please detail what they are and why they should be considered breaking? Also, please read the contributing guide, especially the part about commit messages. |
The public interface of the |
Conflicts with |
Can you elaborate on this? |
I use this formatter to lint SQL in my project. My linter will look at every string in the project and if it looks like SQL it will apply this formatting. There are probably thousands of these so a consistent style is very useful. |
I had no idea this project was used that way… in that particular case, any change does seem like a breaking change, but I'm not sure this means that's the case for most consumers of this project. |
I think this is ready now. This logic of blocks could be used in the future to give better context for both formatting and highligting. For example in the case of |
Fixed lots of issues with formatting non-trivial SQL queries. This is NOT backwards compatible, there are many breaking changes. This is more in line with what looks good to me and what prettier is doing.
Highlights include:
JOIN
s theON
part and other conditions are on a new line and indentedON DUPLICATE KEY UPDATE
is one tokenCASE WHEN
and the like are blocks with indented contents