kuskus
kuskus copied to clipboard
Pre-format the document before passing it to KustoCodeService
The KustoCodeService chunks up a document in sometimes strange ways, which leads to odd document formatting. See JANK_CLEANUP.md for a couple examples of this.
The idea here would be to do a pre-formatting step where newlines are added or removed in certain places before passing the text on to the KustoCodeService, in a way so that the code service chunks it into blocks more logically.
For example,
- when the document is a .create-or-alter statement
- removing blank lines between the .create-or-alter command and the function name, or blank lines between the function name and the opening {.
- adding a blank line between the opening { and the first query block
- adding a blank line between the closing } and the preceding block
- when the document has multiple blocks separated by semi-colons
- adding a blank line after each semi-colon