-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Added SQL Formatter tool #274
Conversation
@akarboush, please feel free to take a look at it :) |
@veler thanks for the mention. For the mean time, I'll try to optimize it on my branch and then propose the changes if there aren't any here yet |
_index = i; | ||
|
||
Token token = TokenOverride(_tokens[i]); | ||
if (token.Type == TokenType.LineComment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could clean a bit all the if else's by using pattern matching.
Sounds good. I think I will do a little bit of clean up before merging, but likely no optimization yet. While all these regex and strings are suboptimal, it seems to work relatively well as long as the SQL query isn't super long. I'd suggest to do the optimizations in a separated PR, what do you think @akarboush ? |
* Added SQL Formatter tool * added resw * Updated terms
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
As a developer working with database, I'd like to be able to format some queries without having to paste them on a random website.
Issue Number: #136
What is the new behavior?
Added a SQL Formatter based on https://github.com/zeroturnaround/sql-formatter
It isn't perfect though. This is a literal translation of the JS library. Some optimizations can be made to reduce the allocation of strings.
Other information
Quality check
Before creating this PR, have you: