Skip to content

Commit

Permalink
Merge pull request godotengine#10504 from Calinou/gdscript-style-guid…
Browse files Browse the repository at this point in the history
…e-icon

Add `@icon` ordering to the GDScript style guide
  • Loading branch information
mhilbrunner authored Jan 13, 2025
2 parents 976238c + 265397c commit 6e1144a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ repetition:
It's recommended to use ``GLOBAL_DEF``/``EDITOR_DEF`` only once per setting and
use ``GLOBAL_GET``/``EDITOR_GET`` in all other places where it's referenced.

.. _doc_common_engine_methods_and_macros_error_macros:

Error macros
------------

Expand Down
45 changes: 23 additions & 22 deletions tutorials/scripting/gdscript/gdscript_styleguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -764,25 +764,26 @@ We suggest to organize GDScript code this way:
::

01. @tool
02. class_name
03. extends
04. ## docstring

05. signals
06. enums
07. constants
08. @export variables
09. public variables
10. private variables
11. @onready variables

12. optional built-in virtual _init method
13. optional built-in virtual _enter_tree() method
14. built-in virtual _ready method
15. remaining built-in virtual methods
16. public methods
17. private methods
18. subclasses
02. @icon
03. class_name
04. extends
05. ## docstring

06. signals
07. enums
08. constants
09. @export variables
10. public variables
11. private variables
12. @onready variables

13. optional built-in virtual _init method
14. optional built-in virtual _enter_tree() method
15. built-in virtual _ready method
16. remaining built-in virtual methods
17. public methods
18. private methods
19. subclasses

We optimized the order to make it easy to read the code from top to bottom, to
help developers reading the code for the first time understand how it works, and
Expand All @@ -803,9 +804,9 @@ Class declaration
If the code is meant to run in the editor, place the ``@tool`` annotation on the
first line of the script.

Follow with the ``class_name`` if necessary. You can turn a GDScript file into a
global type in your project using this feature. For more information, see
:ref:`doc_gdscript`.
Follow with the optional ``@icon`` then the ``class_name`` if necessary. You can turn a
GDScript file into a global type in your project using ``class_name``. For more
information, see :ref:`doc_gdscript`.

Then, add the ``extends`` keyword if the class extends a built-in type.

Expand Down

0 comments on commit 6e1144a

Please sign in to comment.