Browse Source

Add file name conventions in the GDScript style guide (#3355)

This closes #2376.
Hugo Locurcio 5 years ago
parent
commit
a53ab27329
1 changed files with 20 additions and 0 deletions
  1. 20 0
      getting_started/scripting/gdscript/gdscript_styleguide.rst

+ 20 - 0
getting_started/scripting/gdscript/gdscript_styleguide.rst

@@ -427,6 +427,26 @@ These naming conventions follow the Godot Engine style. Breaking these will make
 your code clash with the built-in naming conventions, leading to inconsistent
 code.
 
+File names
+~~~~~~~~~~
+
+Use snake_case for file names. For named classes, convert the PascalCase class
+name to snake_case::
+
+    # This file should be saved as `weapon.gd`.
+    extends Node
+    class_name Weapon
+
+::
+
+    # This file should be saved as `yaml_parser.gd`.
+    extends Object
+    class_name YAMLParser
+
+This is consistent with how C++ files are named in Godot's source code. This
+also avoids case sensitivity issues that can crop up when exporting a project
+from Windows to other platforms.
+
 Classes and nodes
 ~~~~~~~~~~~~~~~~~