Skip to content

Commit d18c89b

Browse files
authored
Update code order with static annotation on gdscript_styleguide.rst (#8920)
* Update code order with static annotation on gdscript_styleguide.rst Update code order on gdscript_styleguide.rst by inserting static variables and methods on the code order as a proposal
1 parent 1fe10df commit d18c89b

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

tutorials/scripting/gdscript/gdscript_styleguide.rst

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -763,27 +763,38 @@ We suggest to organize GDScript code this way:
763763

764764
::
765765

766-
01. @tool
767-
02. @icon
768-
03. class_name
769-
04. extends
770-
05. ## docstring
771-
772-
06. signals
773-
07. enums
774-
08. constants
766+
01. @tool, @icon, @static_unload
767+
02. class_name
768+
03. extends
769+
04. ## doc comment
770+
771+
05. signals
772+
06. enums
773+
07. constants
774+
08. static variables
775775
09. @export variables
776-
10. public variables
777-
11. private variables
778-
12. @onready variables
779-
780-
13. optional built-in virtual _init method
781-
14. optional built-in virtual _enter_tree() method
782-
15. built-in virtual _ready method
783-
16. remaining built-in virtual methods
784-
17. public methods
785-
18. private methods
786-
19. subclasses
776+
10. remaining regular variables
777+
11. @onready variables
778+
779+
12. _static_init()
780+
13. remaining static methods
781+
14. overridden built-in virtual methods:
782+
1. _init()
783+
2. _enter_tree()
784+
3. _ready()
785+
4. _process()
786+
5. _physics_process()
787+
6. remaining virtual methods
788+
15. overridden custom methods
789+
16. remaining methods
790+
17. subclasses
791+
792+
And put the class methods and variables in the following order depending on their access modifiers:
793+
794+
::
795+
796+
1. public
797+
2. private
787798

788799
We optimized the order to make it easy to read the code from top to bottom, to
789800
help developers reading the code for the first time understand how it works, and

0 commit comments

Comments
 (0)