kuskus icon indicating copy to clipboard operation
kuskus copied to clipboard

Pre-format the document before passing it to KustoCodeService

Open rosshamish opened this issue 6 years ago • 0 comments

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

rosshamish avatar Jul 26 '19 03:07 rosshamish