Skip to content

Commit

Permalink
Merge pull request #10437 from dalexeev/gds-doc-warning-ignore-start-…
Browse files Browse the repository at this point in the history
…and-restore

GDScript: Document `@warning_ignore_start` and `@warning_ignore_restore`
  • Loading branch information
tetrapod00 authored Dec 23, 2024
2 parents 5eebe5f + d610bfd commit 1d0a90f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions _extensions/gdscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ def innerstring_rules(ttype):
"@static_unload",
"@tool",
"@warning_ignore",
"@warning_ignore_restore",
"@warning_ignore_start",
),
prefix=r"(?<!\.)",
suffix=r"\b",
Expand Down
16 changes: 11 additions & 5 deletions tutorials/scripting/gdscript/warning_system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ script editor's status bar. The example below has 2 warnings:

.. image:: img/typed_gdscript_warning_example.webp

To ignore specific warnings in one file, insert an annotation of the
form ``@warning_ignore("warning-id")``, or click on the ignore link to the
left of the warning's description. Godot will add an annotation above the
corresponding line and the code won't trigger the corresponding warning
anymore:
To ignore single warnings within a file, use the
:ref:`@warning_ignore <class_@GDScript_annotation_@warning_ignore>` annotation.
You can click on the ignore link to the left of the warning's description.
Godot will add an annotation above the corresponding line and the code
won't trigger the corresponding warning anymore:

.. image:: img/typed_gdscript_warning_system_ignore.webp

To ignore multiple warnings in a region within a file, use the
:ref:`@warning_ignore_start <class_@GDScript_annotation_@warning_ignore_start>`
and :ref:`@warning_ignore_restore <class_@GDScript_annotation_@warning_ignore_restore>`
annotations. You can omit ``@warning_ignore_restore`` if you want to ignore
the specified warning types until the end of the file.

Warnings won't prevent the game from running, but you can turn them into
errors if you'd like. This way your game won't compile unless you fix
all warnings. Head to the ``GDScript`` section of the Project Settings to
Expand Down

0 comments on commit 1d0a90f

Please sign in to comment.