From 265397c5fc1265384336eaa1d7745ea298177cdc Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 13 Jan 2025 17:25:42 +0100 Subject: [PATCH] Add `@icon` ordering to the GDScript style guide --- .../common_engine_methods_and_macros.rst | 2 + .../gdscript/gdscript_styleguide.rst | 41 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/contributing/development/core_and_modules/common_engine_methods_and_macros.rst b/contributing/development/core_and_modules/common_engine_methods_and_macros.rst index 7754a40d1..8a47f21c5 100644 --- a/contributing/development/core_and_modules/common_engine_methods_and_macros.rst +++ b/contributing/development/core_and_modules/common_engine_methods_and_macros.rst @@ -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 ------------ diff --git a/tutorials/scripting/gdscript/gdscript_styleguide.rst b/tutorials/scripting/gdscript/gdscript_styleguide.rst index 9dd84ad05..5a95dbf87 100644 --- a/tutorials/scripting/gdscript/gdscript_styleguide.rst +++ b/tutorials/scripting/gdscript/gdscript_styleguide.rst @@ -764,25 +764,26 @@ We suggest to organize GDScript code this way: :: 01. @tool - 02. class_name - 03. extends - 04. ## docstring + 02. @icon + 03. class_name + 04. extends + 05. ## docstring - 05. signals - 06. enums - 07. constants - 08. @export variables - 09. public variables - 10. private variables - 11. @onready variables + 06. signals + 07. enums + 08. constants + 09. @export variables + 10. public variables + 11. private variables + 12. @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 + 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 @@ -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.