Commit Graph

735 Commits (dec5a373d97cbadce5e1fabe6095ae9957ff3aa6)

Author SHA1 Message Date
Thaddeus Crews a372214a4a
Merge pull request #76020 from dalexeev/gds-warning-ignore-regions
GDScript: Add `@warning_ignore_start` and `@warning_ignore_restore` annotations
2024-12-09 14:33:38 +07:00
Lukas Tenbrink b5c31ebb41 Add contains_char() for single-character 'contains' calls. 2024-12-06 20:23:35 +07:00
Danil Alexeev 7d65d0a908
GDScript: Add `@warning_ignore_start` and `@warning_ignore_restore` annotations 2024-12-06 15:37:02 +07:00
Thaddeus Crews e9ce3932b3
Merge pull request #98099 from dalexeev/pot-gen-add-comment-support
POT Generator: Add support for `TRANSLATORS:` and `NO_TRANSLATE` comments
2024-11-15 10:42:45 +07:00
Clay John b5368d5e40
Merge pull request #98356 from dustdfg/gdscript_endif_readability_comments
Add some comments to `#endif's` where it helps readability
2024-10-24 19:11:42 +07:00
Yevhen Babiichuk (DustDFG) 8c29ef38fc Add some comments to #endif's where it will easier life
Also added some new line to improve readability

Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
Co-authored-by: Danil Alexeev <danil@alexeev.xyz>
2024-10-21 14:31:45 +07:00
HolonProduction 140c6a612e GDScript: Fix annotation parsing adding new annotation entries 2024-10-13 22:43:06 +07:00
Danil Alexeev cab80cb97d
POT Generator: Add support for `TRANSLATORS:` and `NO_TRANSLATE` comments 2024-10-13 11:40:11 +07:00
Rémi Verschelde 0b2446101c
Merge pull request #96693 from HolonProduction/annotation-arg-hint
Autocompletion: Add arghint for annotations
2024-10-02 15:00:58 +07:00
Danil Alexeev 85dfd89653 Add `@export_tool_button` annotation for easily creating inspector buttons
Co-authored-by: jordi <creptthrust@gmail.com>
Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
Co-authored-by: Mack <86566939+Macksaur@users.noreply.github.com>
2024-09-27 22:24:15 +07:00
HolonProduction 00dfd568e0 Autocompletion: Add arghint for annotations 2024-09-07 20:47:34 +07:00
Rémi Verschelde 0b4ae20156
Merge pull request #78656 from Repiteo/typed-dictionary
Implement typed dictionaries
2024-09-06 22:38:13 +07:00
Rémi Verschelde 721d280b8a
Merge pull request #96326 from HolonProduction/completion-hacks-and-fixes
Autocompletion: Reintroduce enum options on assignment
2024-09-04 18:55:27 +07:00
Thaddeus Crews 9853a69144
Implement typed dictionaries 2024-09-04 10:27:26 +07:00
A Thousand Ships 194bdde947
Cleanup of raw `nullptr` checks with `Ref`
Using `is_valid/null` over checks with `nullptr` or `ERR_FAIL_NULL` etc.
2024-08-31 15:01:09 +07:00
HolonProduction 171c522290 Autocompletion: reintroduce enum options on assignment 2024-08-30 13:46:48 +07:00
Aina 930742f8b3 Fix missing GDScriptParser reference on completion context 2024-08-28 17:03:12 +07:00
Rémi Verschelde 6eb1d3cf98
Merge pull request #94888 from rune-scape/no-const-cast-gdscript-parser
GDScriptParser: Avoid `const_cast` of `AnnotationNode`
2024-08-28 00:12:35 +07:00
HolonProduction c824403853 Autocompletion: enable string literal completion in subscripts 2024-08-27 13:02:09 +07:00
Rémi Verschelde 58505b0bce
Merge pull request #94082 from HolonProduction/completion-force
Autocompletion: Rework argument options string literal completion
2024-08-20 10:01:52 +07:00
rune-scape 22f43b7879 Avoid const_cast in GDScriptParser 2024-07-28 08:04:25 +07:00
HolonProduction 4699e69708 Autocompletion: register depended parsers with the main parser 2024-07-18 12:16:28 +07:00
Danil Alexeev 110c4d4067
GDScript: Fix "Mismatched external parser" for autoloads 2024-07-09 16:16:45 +07:00
HolonProduction 0abd0ae364 Autocompletion: rework argument options string literal completion 2024-07-08 17:53:36 +07:00
Hilderin 39369db029 Fix synchronization of global class name 2024-06-25 18:33:07 +07:00
Rémi Verschelde 6882a948b6
Merge pull request #92874 from Chaosus/completion_color_color
Add coloring for completion of Color components
2024-06-24 11:14:02 +07:00
Danil Alexeev 24b6edcd38
GDScript: Fix non-global class export 2024-06-20 14:30:12 +07:00
Rémi Verschelde 09a037628e
Merge pull request #85488 from miv391/fix-expected-indented-block-error-message-lines
Moving "Expected indented block" error message's line number back to where the error is
2024-06-10 16:11:30 +07:00
Yuri Rubinsky 305b948256 Add coloring for completion of Color components 2024-06-07 18:35:56 +07:00
PreslavPetrov 653a8b113a Register the export info correctly when a global class script is used as the variable type for Node 2024-06-03 13:28:17 +07:00
Rémi Verschelde 6761923f4f
Merge pull request #90716 from dalexeev/gds-fix-export-annotation-issues
GDScript: Fix some export annotation issues
2024-05-19 11:21:00 +07:00
Danil Alexeev 7dd801c580
GDScript: Fix `STANDALONE_EXPRESSION` warning for `preload()` 2024-05-17 10:33:01 +07:00
Danil Alexeev 76b2d85c9f
GDScript: Fix some export annotation issues 2024-05-13 17:49:06 +07:00
Rémi Verschelde ff018079a1
Merge pull request #84706 from HolonProduction/completion-get-child
Fix autocompletion after DOLLAR token
2024-05-07 16:49:13 +07:00
K. S. Ernest (iFire) Lee f9b488508c
Add PackedVector4Array Variant type
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-05-03 00:58:27 +07:00
rune-scape 6b88c86cec GDScript: invalidate GDScriptParserRef when reloading 2024-04-18 14:05:58 +07:00
Aiden Storey 74177d79c9
Fix multiline array/dictionary match statements
Currently array and dictionary expressions cannot be spread over
multiple lines in match statements.

Adding mutliline push/pop while parsing the pattern for bracket and
brace enables the ability for these to be multiline. This enables more
complex patterns to be matched without exceeding line limits.

Fixes #90372
2024-04-12 10:59:28 +07:00
George Marques 877802e252
GDScript: Don't warn on unassigned for builtin-typed variables
If the type of a variable is a built-in Variant type, then it will
automatically be assigned a default value based on the type. This means
that the explicit initialization may be unnecessary. Thus this commit
removes the warning in such case.

This also changes the meaning of the unassigned warning to happen when
the variable is used before being assigned, not when it has zero
assignments.
2024-04-10 11:59:57 +07:00
Rémi Verschelde 453485aede
Merge pull request #89270 from Repiteo/enforce-typename-in-templates
Enforce template syntax `typename` over `class`
2024-03-14 22:34:37 +07:00
Danil Alexeev ef1909fca3
GDScript: Fix `@warning_ignore` annotation issues 2024-03-12 19:00:06 +07:00
Danil Alexeev 87718d2a6e
Editor Help: Add syntax highlighting for code blocks 2024-03-09 00:02:31 +07:00
Thaddeus Crews 9903e6779b
Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 +07:00
George Marques 8e520454ef
GDScript: Add @export_custom annotation
Allows setting any arbitrary hint, hint string, and usage flags.
Useful for more complex hints or potential future hints not
available as a dedicated annotation.
2024-03-07 10:55:21 +07:00
Abel Toy 882441a0ad
Support Array and PackedArray in @export_* 2024-03-06 16:17:54 +07:00
HolonProduction 1621e725fa Fix autocompletion after DOLLAR token 2024-03-02 18:56:02 +07:00
Rémi Verschelde 21ee3716c2
Merge pull request #82122 from dalexeev/gds-add-export-hidden-annotation
GDScript: Add `@export_storage` annotation
2024-02-27 21:22:49 +07:00
Danil Alexeev 8ffc50ee8c
GDScript: Canonicalize script path in FQCN 2024-02-26 10:46:24 +07:00
Danil Alexeev af28f87791
Documentation: Add support for deprecated/experimental messages 2024-02-15 15:59:50 +07:00
A Thousand Ships 684752e75b
Replace error checks against `size` with `is_empty` 2024-02-09 12:50:15 +07:00
George Marques 72e5f8c31e
GDScript: Enable compression on export
Besides the regular option to export GDScript as binary tokens, this
also includes a compression option on top of it. The binary format
needs to encode some information which generally makes it bigger than
the source text. This option reduces that difference by using Zstandard
compression on the buffer.
2024-02-08 11:20:07 +07:00
George Marques b4d0a09f15
GDScript: Reintroduce binary tokenization on export
This adds back a function available in 3.x: exporting the GDScript
files in a binary form by converting the tokens recognized by the
tokenizer into a data format.

It is enabled by default on export but can be manually disabled. The
format helps with loading times since, the tokens are easily
reconstructed, and with hiding the source code, since recovering it
would require a specialized tool. Code comments are not stored in this
format.

The `--test` command can also include a `--use-binary-tokens` flag
which will run the GDScript tests with the binary format instead of the
regular source code by converting them in-memory before the test runs.
2024-02-08 11:20:05 +07:00
Rémi Verschelde 9a793d95eb
Merge pull request #87124 from rsubtil/bugfix-warn_as_err
Simplify script paths to ensure proper resource path checks
2024-02-08 13:45:57 +07:00
Danil Alexeev 2bf25954b4
GDScript: Add `is not` operator 2024-02-04 17:36:53 +07:00
Rémi Verschelde 745f8e112f
Revert "Add UID support to GDScript files"
This reverts commit c7f68a27ec.

We still think GDScript files need UIDs to allow safe refactoring,
but we're still debating what form those should take exactly.

So far there seems to be agreement that it shouldn't be done via an
annotation as implemented here, so we're reverting this one for now,
to revisit the feature in a future PR.
2024-01-29 21:00:26 +07:00
A Thousand Ships 15369fdb1d
Remove unnecessary `this->` expressions 2024-01-29 09:59:18 +07:00
kobewi c7f68a27ec Add UID support to GDScript files 2024-01-17 22:30:56 +07:00
Ricardo Subtil a06e5f70bc Simplify script paths to ensure proper resource path checks 2024-01-12 17:53:59 +07:00
Rémi Verschelde 150f2a75b2
Merge pull request #83120 from dalexeev/gds-allow-property-getter-empty-parentheses
GDScript: Allow empty parentheses for property getter declaration
2024-01-04 16:39:16 +07:00
Rémi Verschelde 6c390b620d
Merge pull request #84445 from Rubonnek/add-const-references-clang-tidy
Add const references detected by clang-tidy
2024-01-04 14:25:33 +07:00
Danil Alexeev 3a3a2011f4
GDScript: Add `@export_storage` annotation 2023-12-19 20:56:30 +07:00
Yuri Sizov a6f806f8da Merge pull request #85487 from vnen/gdscript-static-register-annotations
GDScript: Make annotations register statically in parser
2023-12-19 13:02:09 +07:00
Wilson E. Alvarez a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 +07:00
Thaddeus Crews 5cf0d772bc
Change container_element_type to vector container 2023-12-05 08:51:49 +07:00
Mika Viskari d168dada36 Moving 'Expected indented block' error message lines numbers back 2023-11-28 23:09:11 +07:00
George Marques 39e8cf891d
GDScript: Make annotations register statically in parser
So it only register the annotations once per run instead of doing it
every time a script is parsed.
2023-11-28 17:16:21 +07:00
Danil Alexeev 668ba2d1a5
GDScript: Allow empty parentheses for property getter declaration 2023-10-11 09:54:17 +07:00
Rémi Verschelde 53c6c387ef
Merge pull request #83050 from k0T0z/fix-unnecessary-include
Deleting unnecessary include in GDScriptParser
2023-10-10 12:33:58 +07:00
Saif Kandil 3e57279be2 removing unnecessary include of gdscript_warning.h as it is already included in the header file
Signed-off-by: Saif Kandil <74428638+k0T0z@users.noreply.github.com>
2023-10-09 18:00:44 +07:00
A Thousand Ships f18aa00e85 Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-10-08 17:23:33 +07:00
Danil Alexeev 9e2273abc7
GDScript: Add error when exporting node in non [Node]-derived classes 2023-10-05 13:50:26 +07:00
Yuri Sizov 813cd1dfc8 Merge pull request #80085 from vnen/gdscript-pattern-guards
GDScript: Implement pattern guards for match statement
2023-09-28 20:03:57 +07:00
Yuri Sizov aa474c9feb Merge pull request #75988 from dalexeev/gds-unsafe-call-argument
GDScript: Improve call analysis
2023-09-27 19:07:46 +07:00
George Marques 54a1414500
GDScript: Implement pattern guards for match statement
Within a match statement, it is now possible to add guards in each
branch:

	var a = 0
	match a:
		0 when false: print("does not run")
		0 when true: print("but this does")

This allows more complex logic for deciding which branch to take.
2023-09-27 11:25:25 +07:00
A Thousand Ships 517e9f8aef [Modules] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-26 16:44:52 +07:00
Danil Alexeev e8696f9961
GDScript: Improve call analysis
* Add missing `UNSAFE_CALL_ARGUMENT` warning.
* Fix `Object` constructor.
* Display an error for non-existent static methods.
2023-09-21 13:36:39 +07:00
Rémi Verschelde 281439ce20
Merge pull request #81699 from dalexeev/gds-fix-and-improve-doc-comment-parsing
GDScript: Fix and improve doc comment parsing
2023-09-20 13:09:32 +07:00
Danil Alexeev c35cb51d74
GDScript: Fix subscript resolution for constant non-metatypes 2023-09-19 22:26:06 +07:00
Danil Alexeev 072e9c5c82
GDScript: Fix and improve doc comment parsing 2023-09-16 17:31:50 +07:00
Rémi Verschelde 13f0ab88f2
Merge pull request #81079 from dalexeev/gds-fix-get-method-list
GDScript: Fix `get_*_list()` methods return incorrect info
2023-09-11 15:36:52 +07:00
Danil Alexeev 462d8f4752
GDScript: Fix `get_*_list()` methods return incorrect info 2023-09-04 00:21:03 +07:00
Yuri Rubinsky 35802374ac Add coloring for completion of vector components 2023-08-30 21:13:25 +07:00
Rémi Verschelde 91c5273ec5
Merge pull request #75656 from YuriSizov/core-iconic-builtins
Add a script method to get its class icon
2023-08-29 12:41:03 +07:00
Yuri Sizov b6c4efe1b1 Merge pull request #80964 from dalexeev/gds-allow-use-local-consts-as-types
GDScript: Allow use local constants as types
2023-08-25 21:26:44 +07:00
Danil Alexeev 68a567bd13
GDScript: Allow use local constants as types 2023-08-25 17:04:04 +07:00
Danil Alexeev 89429b0273
GDScript: Fix lambda resolution with cyclic references 2023-08-25 16:29:11 +07:00
Yuri Sizov 2c77f07aaa Add a script method to get its class icon
Co-authored-by: Danil Alexeev <danil@alexeev.xyz>
2023-08-24 13:05:41 +07:00
Danil Alexeev 6c59ed9485
GDScript: Add static typing for `for` loop variable 2023-08-17 20:54:34 +07:00
Rémi Verschelde 4f00f925b3
Merge pull request #78552 from dalexeev/gds-check-get-node-in-static-func
GDScript: Check `get_node()` shorthand in static functions
2023-08-17 11:20:32 +07:00
Markus Sauermann fa8fec2cc1 Fix superfluous `"` in error message 2023-08-13 00:38:10 +07:00
Danil Alexeev 0f27c4ad80
GDScript: Check `get_node()` shorthand in static functions 2023-08-09 17:11:38 +07:00
Yuri Sizov 68a49c4959 Merge pull request #79935 from dalexeev/gds-validate-node-path-annotation
GDScript: Add validation for `@export_node_path` annotation arguments
2023-08-01 17:25:44 +07:00
Yuri Sizov 3de7dd902c Merge pull request #79880 from dalexeev/gds-fix-id-shadowing-below
GDScript: Fix bug with identifier shadowed below in current scope
2023-07-31 21:01:36 +07:00
Yuri Sizov 41efc7cb86 Merge pull request #78941 from dalexeev/gds-doc-comments-deprecated-and-experimental
GDScript: Add `@deprecated` and `@experimental` doc comment tags
2023-07-31 21:01:08 +07:00
Danil Alexeev 5b4403c9a5
GDScript: Add validation for `@export_node_path` annotation arguments
Co-authored-by: George Marques <george@gmarqu.es>
2023-07-26 20:36:47 +07:00
Danil Alexeev d53fc92b4c
GDScript: Fix bug with identifier shadowed below in current scope 2023-07-26 11:26:57 +07:00
jpcerrone 13c73500ab Fix for not being able to ignore shadowing warnings on class scope 2023-07-24 17:22:12 +07:00
George Marques cbfe2b61b6
GDScript: Properly track extents of constants and patterns
Even in the case of errors.
2023-07-12 10:57:11 +07:00
Rémi Verschelde 8a06ec979e
Change explicit 'Godot 4.0' references to 'Godot 4'
Fixes #79276.
2023-07-10 13:08:11 +07:00
Danil Alexeev c1b450566a
GDScript: Add `@deprecated` and `@experimental` doc comment tags 2023-07-08 18:13:19 +07:00
Rémi Verschelde faf3faa8c8
Merge pull request #77744 from dalexeev/gds-reset-block-locals-on-exit
GDScript: Reset local variables on exit from block
2023-06-21 21:51:05 +07:00