Format code on saving script plugin for Godot 4
| rules | ||
| screenshots | ||
| test | ||
| .gitattributes | ||
| .gitignore | ||
| formatter.gd | ||
| formatter.gd.uid | ||
| LICENSE.md | ||
| LICENSE.txt | ||
| plugin.cfg | ||
| README.md | ||
| simple_format_on_save.gd | ||
| simple_format_on_save.gd.uid | ||
Simple Format On Save 🌠
Original plugin by ducviet321
A Godot addon that automatically formats GDScript whenever you save it.
Features
- Does not require gdtoolkit
- Automatic code formatting when saving files
- Clean and consistent code style
- Zero configuration, lightweight and simple to use
Installation
- Download or clone this repository as a submodules into
addons/SimpleFormatOnSave - Enable the plugin in Project Settings -> Plugins
Formatting Rules
The addon applies the following formatting rules to your GDScript code:
- Consistent indentation using tabs
- 2 blank lines between functions
- No trailing whitespace
- Space before statements (if, for, while...)
- Space after code block
- No extra blank lines at the start or end of files
- Proper spacing around parentheses and brackets
Optionals rules
Some rules can be changed in Editor Settings -> Text Editor -> Format on Save
| Rule | Desc | Default state |
|---|---|---|
blank_after_dedent |
Let a blank line after any dedent | false |
Usage
Simply save your GDScript files (.gd) and the addon will automatically format them according to the rules above.
License
See the LICENSE file for details.
Special Thanks 🎈
This addon combines the functionality of
🐰 simple_gdscript_formatter by madwind 🐰 Format On Save by ryan-haskell
