Custom Formatting and Refactoring (API)
I would like to expand upon suggestions others have made regarding adding custom formatting and analyzers.
I have recently been trying to implement SQL Prompt for our team, and I have struggles with a lack of customization, opinionated options that don’t reflect our needs, and some bugs.
What would have solved this issue for me would have been the ability to add custom formatters and custom analyzers.
Custom Formatters
Since SQL Prompt gets the position of tokens from IAlignmentProvider.FinalAlignmentForToken I suggest that the API couple simply be plumbed into this method, if a plugin is attached it would call the plugin with the current CalculatedAlignment and a context providing information about where in the script the token is located (in a select clause, from clause, sub query etc.), and the plugin would return a CalculatedAlignment and the process would resume as it currently does.
Custom Analyzers
Since SQL Prompt defines Interfaces for code analysis, I suggest that plugins should implement the IRuleProcessor and IRefactoring interfaces.
It wouldn’t be the most elegant API, but it should be straight forward to implement.