Commit graph

581 commits

Author SHA1 Message Date
Fabio Alessandrelli
116f783db7
Merge pull request #76207 from dalexeev/clarify-rpc-docs
Clarify `@rpc` annotation arguments docs
2023-06-18 21:34:34 +02:00
Rémi Verschelde
fcc39d498b
Merge pull request #75051 from AleryBerry/fix-error-message-lua-style
GDScript: Fix error message for LUA-style dictionary
2023-06-18 16:28:36 +02:00
Rémi Verschelde
25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
Danil Alexeev
ddd9aa11b3
Clarify @rpc annotation arguments docs 2023-06-13 21:33:48 +03:00
Danil Alexeev
049a49cac0
GDScript: Fix doc comment parsing (newlines and spaces) 2023-06-05 16:00:46 +03:00
Rémi Verschelde
06d337af80
Merge pull request #75943 from adamscott/fix-missing-script-type-nullptr-check
Add missing `script_type` `nullptr` check
2023-05-22 13:48:32 +02:00
smix8
a6ac305f96 Rework Navigation Avoidance
Rework Navigation Avoidance.
2023-05-10 05:01:58 +02:00
George Marques
0ba6048ad3
Add support for static variables in GDScript
Which allows editable data associated with a particular class instead of
the instance. Scripts with static variables are kept in memory
indefinitely unless the `@static_unload` annotation is used or the
`static_unload()` method is called on the GDScript.

If the custom function `_static_init()` exists it will be called when
the class is loaded, after the static variables are set.
2023-04-27 09:51:44 -03:00
Yuri Sizov
26fb911f79
Merge pull request #72095 from anvilfolk/gd-docs
Improve GDScript documentation generation & behavior
2023-04-26 16:54:25 +02:00
Rémi Verschelde
54b0e8123e
Merge pull request #75605 from anvilfolk/type-base
Make GDScript type not found errors more informative.
2023-04-24 16:43:32 +02:00
ocean (they/them)
6783ff69c0 Improve and fix GDScript documentation generation & behavior
Removes documentation generation (docgen) from the GDScript compiler to
its own file. Adds support for GDScript enums and signal parameters and
quite a few other assorted fixes and improvements.
2023-04-21 10:17:30 -04:00
Danil Alexeev
dbc3c82043
GDScript: Add some checks for @tool and @icon 2023-04-20 07:44:10 +03:00
Yuri Sizov
6596a6c1b5
Merge pull request #72979 from dalexeev/gds-annotation-parsing
GDScript: Fix and improve annotation parsing
2023-04-17 17:14:58 +02:00
Yuri Sizov
d220680bd0
Merge pull request #62830 from ajreckof/access-identifier-keywords
fix access to identifiers that are reserved keywords
2023-04-17 17:12:10 +02:00
ajreckof
ab9f60dd1a fix access to identifiers that are reserved keywords 2023-04-14 20:37:24 +02:00
Danil Alexeev
5038a336be
GDScript: Fix and improve annotation parsing 2023-04-14 21:28:46 +03:00
Adam Scott
1236302388 Add missing script_type nullptr check
Co-authored-by: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
2023-04-11 12:36:28 -04:00
VolTer
f832eb92e4 Fix mistakes in documentation and GDScript errors 2023-04-10 10:00:09 +02:00
ocean (they/them)
5d164df4e1 Make type not found errors more informative.
This PR removes a check for whether a datatype is a meta type when
generating a datatype's to_string() result. This means that error
messages that fail to find the type will now print their class names,
which is much more useful when trying to identify errors.
2023-04-02 18:30:30 -04:00
AleryBerry
0550f3682b GDScript: Fix error message for Lua-style dictionary 2023-03-20 21:45:06 +00:00
Dmitrii Maganov
4e34cf238a GDScript: Change parser representation of class extends 2023-03-13 01:40:13 +02:00
Rémi Verschelde
9eaaeef76d
Merge pull request #73410 from MewPurPur/Fixin-error-spam-2-Electric-Boogaloo
Fix error spam when naming a func at the end of the script
2023-03-08 08:54:57 +01:00
VolTer
07dd627728 Fix error spam when naming a func at the end of the script 2023-03-07 23:42:40 +01:00
Dmitrii Maganov
b0b1eaeb6d GDScript: Fix parsing unexpected break/continue in lambda 2023-02-23 10:49:06 +02:00
Dmitrii Maganov
8fe023ad93 GDScript: Rework type check 2023-02-17 19:57:18 +02:00
Danil Alexeev
220898a69f
GDScript: Remove treat_warnings_as_errors project setting 2023-02-10 10:16:33 +03:00
Rémi Verschelde
dc7f08b556
Merge pull request #72971 from vnen/gdscript-multiline-comment
GDScript: Allow strings as multiline comments
2023-02-09 16:19:03 +01:00
George Marques
03ea77407c
GDScript: Be more lenient with identifiers
- Allow identifiers similar to keywords if they are in ASCII range.
- Allow constants to be treated as regular identifiers.
- Allow keywords that can be used as identifiers in expressions.
2023-02-09 11:19:05 -03:00
George Marques
f95967c299
GDScript: Allow strings as multiline comments
Bring back the behavior in 3.x that was left out by oversight.
2023-02-09 10:16:00 -03:00
Danil Alexeev
c8e3d8b5d5
GDScript: Improve validation and documentation of @export_flags 2023-02-07 19:32:08 +03:00
Yuri Sizov
7b86a082be
Merge pull request #72804 from vnen/gdscript-no-onready-without-node
GDScript: Fix inheritance check of @onready for inner classes
2023-02-06 23:03:44 +03:00
Yuri Sizov
de4369ca4b
Merge pull request #72708 from KoBeWi/PackedMultilineStringArray
Fix @export_multiline for PackedStringArray
2023-02-06 23:01:16 +03:00
George Marques
ed5ddab7e5
GDScript: Fix inheritance check of @onready for inner classes 2023-02-06 14:52:13 -03:00
Rémi Verschelde
eee343210d
Merge pull request #72330 from MinusKube/unreachable_code_bug
Fix unreachable code warning for elif block
2023-02-06 17:49:37 +01:00
Rémi Verschelde
8a37fad281
Merge pull request #72794 from vnen/gdscript-no-onready-without-node
GDScript: Don't allow @onready without inheriting Node
2023-02-06 15:41:02 +01:00
George Marques
3941af3d91
GDScript: Don't allow @onready without inheriting Node 2023-02-06 10:45:38 -03:00
Danil Alexeev
31749de128
GDScript: Better handling of @rpc annotation and autocompletion 2023-02-05 21:21:37 +03:00
Yuri Sizov
13f0158e49
Merge pull request #72608 from vnen/gdscript-warning-default-error
GDScript: Add warnings that are set to error by default (take 2)
2023-02-05 16:00:26 +03:00
kobewi
2b71ede967 Fix @export_multiline for PackedStringArray 2023-02-04 17:06:58 +01:00
GeroVeni
54f2226ce5 Improve docs for rpc annotations 2023-02-04 13:28:41 +00:00
George Marques
273bf7210f
GDScript: Add warnings that are set to error by default
- Adds a list of default levels for all warning so they can be set
  individually.
- Add warnings set by default to error for:
  - Using `get_node()` without `@onready`.
  - Using `@onready` together with `@export`.
  - Inferring a static type with a Variant value.
  - Overriding a native engine method.
- Adjust how annotations to ignore warnings are treated so they also
  apply to method parameters.
- Clean up a bit how ignored warnings are set. There were two sets but
  only one was actually being used.
- Set all warnings to the `WARN` level for tests, so they they can be
  properly tested.
- Fix enum types in native methods signatures being set to `int`.
- Fix native enums being treated as Dictionary by mistake.
- Make name of native enum types use the class they are defined in, not
  the direct super class of the script. This ensures they are always
  equal even when coming from different sources.
- Fix error for signature mismatch that was only showing the first
  default argument as having a default. Now it shows for all.
2023-02-02 12:07:25 -03:00
Danil Alexeev
4311836be2
GDScript: Fix crash in export group annotations 2023-02-02 08:37:39 +03:00
Rémi Verschelde
afe3b94ab2
Revert "GDScript: Add warnings that are set to error by default"
This reverts commit a166833bfa.

This caused multiple regressions.
Needs to be redone with more testing before merge.

Fixes #72501.
2023-02-01 10:54:22 +01:00
George Marques
a166833bfa
GDScript: Add warnings that are set to error by default
- Adds a list of default levels for all warning so they can be set
  individually.
- Add warnings set by default to error for:
  - Using `get_node()` without `@onready`.
  - Using `@onready` together with `@export`.
  - Inferring a static type with a Variant value.
  - Overriding a native engine method.
- Adjust how annotations to ignore warnings are treated so they also
  apply to method parameters.
- Clean up a bit how ignored warnings are set. There were two sets but
  only one was actually being used.
- Set all warnings to the `WARN` level for tests, so they they can be
  properly tested.
- Fix enum types in native methods signatures being set to `int`.
- Fix native enums being treated as Dictionary by mistake.
- Make name of native enum types use the class they are defined in, not
  the direct super class of the script. This ensures they are always
  equal even when coming from different sources.
- Fix error for signature mismatch that was only showing the first
  default argument as having a default. Now it shows for all.
2023-02-01 00:05:14 -03:00
Danil Alexeev
83cb968965
GDScript: Fix @icon annotation 2023-01-31 17:43:54 +03:00
Dmitrii Maganov
5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
George Marques
65407dd42d
GDScript: Fix match branches return check on release
The check for existence of `return` only existed on debug builds for
match branches. This could lead on an invalid error after exporting. Now
this is checked on relase too, so it works the same as the editor.
2023-01-30 15:18:36 -03:00
Rémi Verschelde
af57bdb193
Merge pull request #72305 from dalexeev/gfs-fix-export-enum
GDScript: Fix `@export_enum` works only with `int`
2023-01-30 14:47:12 +01:00
Danil Alexeev
d4b78c352f
GDScript: Fix @export_enum works only with int 2023-01-30 12:30:37 +03:00
Rémi Verschelde
a2817eca03
Merge pull request #72175 from dalexeev/gds-fix-export-group-annotations
GDScript: Fix broken export group annotations
2023-01-30 10:00:54 +01:00