I use Microsoft SQL Server all the time at work. I’ve been having a very difficult time finding a formatter for Transact SQL that formats the code in a way that I like. Since I couldn’t find one, I thought it would be a good idea to write one!
It has also be quite difficult to find a good lexer / parser for TSQL. The only one that I could find was part of the SQL Server class library. Check here for more details.
- Add configuration support
- Properly indentation for
AND
andOR
clauses that are nested within parenthesis - Add unit testing?
- For special cases like
CREATE
,UPDATE
,DELETE
reset the clause stack… assuming these aren’t statements. - Making the spacing around ()’s more normal