mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 19:29:06 +00:00
Merge pull request #3030 from aaronfranke/formatting
Add file formatting to GDScript style guide
This commit is contained in:
@@ -31,12 +31,16 @@ Formatting conventions
|
||||
----------------------
|
||||
|
||||
* Use line feed (**LF**) characters to break lines, not CRLF or CR.
|
||||
* Use one line feed character at the end of each file, except for `csproj` files.
|
||||
* Use **UTF-8** encoding without a `byte order mark <https://en.wikipedia.org/wiki/Byte_order_mark>`_.
|
||||
* Use **4 spaces** instead of tabs for indentation (which is referred to as "soft tabs").
|
||||
* Consider breaking a line into several if it's longer than 100 characters.
|
||||
|
||||
Code structure
|
||||
--------------
|
||||
|
||||
Line breaks and blank lines
|
||||
---------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For a general indentation rule, follow `the "Allman Style" <https://en.wikipedia.org/wiki/Indentation_style#Allman_style>`_
|
||||
which recommends placing the brace associated with a control statement on the next line, indented to
|
||||
@@ -133,7 +137,7 @@ Avoid inserting a blank line:
|
||||
}
|
||||
|
||||
Using spaces
|
||||
------------
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Insert a space:
|
||||
|
||||
|
||||
@@ -18,18 +18,19 @@ styleguide.
|
||||
.. note:: Godot's built-in script editor uses a lot of these conventions
|
||||
by default. Let it help you.
|
||||
|
||||
Code structure
|
||||
--------------
|
||||
Formatting conventions
|
||||
----------------------
|
||||
|
||||
Indentation
|
||||
~~~~~~~~~~~
|
||||
|
||||
Indent type: Tabs *(editor default)*
|
||||
|
||||
Indent size: 4 *(editor default)*
|
||||
* Use line feed (**LF**) characters to break lines, not CRLF or CR. *(editor default)*
|
||||
* Use one line feed character at the end of each file. *(editor default)*
|
||||
* Use **UTF-8** encoding without a `byte order mark <https://en.wikipedia.org/wiki/Byte_order_mark>`_. *(editor default)*
|
||||
* Use **Tabs** instead of spaces for indentation. *(editor default)*
|
||||
|
||||
Each indent level should be one greater than the block containing it.
|
||||
|
||||
Code structure
|
||||
--------------
|
||||
|
||||
**Good**:
|
||||
|
||||
::
|
||||
|
||||
Reference in New Issue
Block a user