Skip to content

Commit ce527c7

Browse files
committed
Rewrite the code formatter, implement multiple requested features,
address bugs This is a rewrite of the code formatter that changes the architecture, removes dependencies, and makes it more robust and powerful. In short, this: - Implements requested features including automated line wrapping or editorconfig support - Addresses several known issues - Gets rid of multiple dependencies - Improves performance by an order of magnitude. Speedups range from 10x to over 50x depending on the case Because this implements automated line wrapping this changes the formatter's behavior. Features and tasks: Close #145: Remove all unwraps from project and follow stricter linting rules Close #250: Rewrite the formatter to make it more robust Close #220: Refactor post-processing to use a visitor pattern + AST edits instead of regex Close #249: Allow configuring number of lines between functions Close #244: Add editorconfig support Close #151: Add an option to preserve leading indentation within code blocks Part of #181: Godot addon: Add a way to have shared settings across a team Bug fixes: Fix #235: Formatter issue related to extra space in front of class_name Fix #245: Wrong @annotation formatting inside an inner class Fix #242: --reorder-code detaches per-function @warning_ignore(...) from its function in scripts without a class_name/extends header Fix #247: Wrong region order in the inner class Fix  #225: lint loop-variable-name for unused vars Fix #190: If statement and comment line get dedented in this nested code block Fix #207: In some situations formatting with vs without --reorder-code is not indempotent Fix #189: Command 'Unistall Formatter' doesn't exists. Fix #248: Installing the binary formatter on mac m1 with arm installs wrong x86
1 parent 44dd067 commit ce527c7

193 files changed

Lines changed: 7838 additions & 4771 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/test.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
3131
restore-keys: |
3232
${{ runner.os }}-cargo-
33+
- name: Clippy
34+
run: cargo clippy --workspace --all-targets -- -D warnings
3335
- name: Build
3436
run: cargo build --workspace --all-targets
3537
- name: Run tests

‎CHANGELOG.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,38 @@
22

33
This file documents the changes made to the formatter with each release.
44

5+
## (Unreleased) Development version 0.21.0 (2026-07-11)
6+
7+
### Added
8+
9+
- Implement automated line wrapping with a configurable max line length option (#187)
10+
- Add EditorConfig support to share formatting settings across devices or a team (#244)
11+
- Add option to preserve leading indentation within code blocks (#151)
12+
- Add a way to disable the formatter on code regions (Thanks @discordier!)
13+
- Allow configuring the number of blank lines between functions (#249)
14+
- Allow configuring the number of extra indents in continuation lines
15+
16+
### Changed
17+
18+
- Complete rewrite of the code formatter to make it more robust and much faster too (#250, #72)
19+
- Refactor post-processing to use a visitor pattern with AST edits instead of regex-based processing (#220)
20+
- Remove all `unwrap()` calls from the project and follow stricter linting rules (#145)
21+
- Remove multiple third-party dependencies and greatly improve compilation speed
22+
- Improve performance by an order of magnitude (10x to over 50x speedup depending on the case)
23+
24+
### Fixed
25+
26+
- Fix formatter issue with extra space in front of `class_name` (#235)
27+
- Fix wrong `@annotation` formatting inside an inner class (#245)
28+
- Fix `--reorder-code` detaching per-function `@warning_ignore(...)` from its function in scripts without a `class_name`/`extends` header (#242)
29+
- Fix wrong region order in inner classes (#247)
30+
- Fix `lint loop-variable-name` for unused variables (#225)
31+
- Fix `if` statement and comment line getting dedented in nested code blocks (#190)
32+
- Fix formatting with vs without `--reorder-code` not being idempotent in some situations (#207)
33+
- Fix Godot addon: "Uninstall Formatter" command doesn't exist (#189)
34+
- Fix Godot addon: Installing the binary formatter on Mac M1 with ARM installs wrong x86 binary (#248)
35+
36+
537
## Release 0.20.1 (2026-05-26)
638

739
### Fixed

0 commit comments

Comments
 (0)