Skip to content

GDScript formatter 0.21.0

Latest

Choose a tag to compare

@github-actions github-actions released this 16 Jul 14:06

A fast code formatter for GDScript in Godot 4.

Changelog

Added

  • Implement automated line wrapping with a configurable max line length option (#187)
  • Add EditorConfig support to share formatting settings across devices or a team (#244)
  • Add option to preserve leading indentation within code blocks (#151)
  • Add a way to disable the formatter on code regions (Thanks @discordier!)
  • Allow configuring the number of blank lines between functions (#249)
  • Allow configuring the number of extra indents in continuation lines
  • Add support for files using Unicode identifiers (accents, Japanese, Chinese, Hebrew, etc.) (#255)
  • Add an option to prefer a single or double quotes for strings (#193)

Changed

  • Complete rewrite of the code formatter to make it more robust and much faster too (#250, #72)
  • Refactor post-processing to use a visitor pattern with AST edits instead of regex-based processing (#220)
  • Remove all unwrap() calls from the project and follow stricter linting rules (#145)
  • Remove multiple third-party dependencies and greatly improve compilation speed
  • Improve performance by an order of magnitude (10x to over 50x speedup depending on the case)
  • Always lay enums vertically (one member per line) (#266)

Fixed

  • Fix formatter issue with extra space in front of class_name (#235)
  • Fix wrong @annotation formatting inside an inner class (#245)
  • Fix --reorder-code detaching per-function @warning_ignore(...) from its function in scripts without a class_name/extends header (#242)
  • Fix wrong region order in inner classes (#247)
  • Fix lint loop-variable-name for unused variables (#225)
  • Fix if statement and comment line getting dedented in nested code blocks (#190)
  • Fix formatting with vs without --reorder-code not being idempotent in some situations (#207)
  • Fix code inside dedented region comments getting dedented too: region comments will now indent into the code (#172)
  • Fix dedented comment in a block's body (function body, loop body, if statement body...) causing following lines in the block to be dedented too (#252)
  • Preserve up to 1 blank line between consecutive declarations when reordering (#268)
  • Godot addon fixes:
    • Fix formatter undoes any changes in script if they have not been saved (#243)
    • Fix "Uninstall Formatter" command doesn't exist message (#189)
    • Fix installing the binary formatter on Mac M1 with ARM installs wrong x86 binary (#248)

Learn more about the formatter in the GDScript Formatter documentation