Skip to content

Added a formatter

Gregor Niehl requested to merge gregorni/blueprint-compiler:formatter into main

Will hopefully one day close #116 (closed).

Things to do:

  • Use an AST (abstract syntax tree) for formatting instead of compiling and then decompiling again
  • Write to the file by opening it with argparse.FileType("rw") instead of using open()
  • Allow directories containing blp files as input
  • Actually use the AST built to insert whitespace at the right places
  • Handle comments properly
  • Differentiate between child types and lists and format them accordingly
  • Add LSP integration
  • Newline between closing token and property
  • Support item (label, action, icon) syntax
  • No newline between comments and lines with opening tokens
  • No whitespace/newlines between } and ;
  • Cleanup
  • Refactor & denest for readability
Edited by Gregor Niehl

Merge request reports