Commit Graph

3273 Commits

Author SHA1 Message Date
Rémi Verschelde 0364443d12
Merge pull request #93346 from RandomShaper/gds_cyc_alt
GDScript: Enhance handling of cyclic dependencies
2024-06-26 18:15:16 +02:00
Pedro J. Estébanez c1391489e3 GDScript: Enhance handling of cyclic dependencies 2024-06-26 17:44:32 +02:00
Rémi Verschelde 93fc9b8857
Merge pull request #93566 from Chaosus/gds_fix_enum_lookup
Fix symbol lookup for native enums
2024-06-26 15:19:31 +02:00
Hilderin 39369db029 Fix synchronization of global class name 2024-06-25 18:33:07 -04:00
Hilderin e18db6fe60 Fix editor crash when invalid global class script path 2024-06-25 08:13:04 -04:00
Yuri Rubinsky 322c64c6ea Fix symbol lookup for native enums 2024-06-25 09:43:11 +03: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 +02:00
Thaddeus Crews cc6dd8d02c
Style: Optimize `.svg` files with `svgo` 2024-06-23 08:15:19 -05:00
Rémi Verschelde de59dca156
Merge pull request #93384 from dalexeev/gds-fix-non-global-class-export
GDScript: Fix non-global class export
2024-06-21 13:55:23 +02:00
Rémi Verschelde 5ac2631af7
Merge pull request #92688 from HolonProduction/autocompletion-batch-2
Add more autocompletion tests
2024-06-21 10:14:13 +02:00
Danil Alexeev 24b6edcd38
GDScript: Fix non-global class export 2024-06-20 14:30:12 +03:00
Pedro J. Estébanez d334632908 GDScript: Avoid deadlock possibility in multi-threaded load 2024-06-19 14:01:54 +02:00
Rémi Verschelde cd87b0bf84
Merge pull request #93057 from HolonProduction/not-enough-code-paths
Autocompletion: Add support for string name option in more places
2024-06-19 10:53:21 +02:00
Rémi Verschelde 9a1e5aea69
Merge pull request #92588 from AThousandShips/font_sname
[Scene] Add `SceneStringNames::font(_size/_color)`
2024-06-18 17:59:06 +02:00
Rémi Verschelde 6c3f811f08
Merge pull request #92177 from KoBeWi/literally_wtf
Fix broken built-in script reloading
2024-06-18 17:59:03 +02:00
A Thousand Ships d519715d94
[Scene] Add `SceneStringNames::font(_size/_color)` 2024-06-18 17:24:27 +02:00
Hilderin c419b548d2 Fix mismatched external parser with binary exports 2024-06-14 11:18:52 -04:00
HolonProduction 51f74af2ac Autocompletion: Add support for string name option in more places 2024-06-12 20:38:43 +02:00
Rémi Verschelde 4516050e64
Merge pull request #92885 from Chaosus/fix_goto_definition_for_new
Fix goto definition for `new` method
2024-06-12 10:00:34 +02: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 +02:00
Yuri Rubinsky 5962646fd3 Fix goto definition for `new` method 2024-06-08 10:52:01 +03:00
Yuri Rubinsky 305b948256 Add coloring for completion of Color components 2024-06-07 18:35:56 +03: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 +01:00
HolonProduction 48e297c144 Add more autocompletion tests 2024-06-02 15:52:21 +02:00
rune-scape 7f7114c008 GDScript: partially allow some functions on invalid scripts
+ always default initialize static variables
+ dont invalidate script when dependant scripts don't compile/resolve
2024-06-02 02:08:26 -07:00
rune-scape ffc0d0981b GDScript: Invalidate cached parser chain when reloading 2024-05-31 18:49:48 -07:00
Rémi Verschelde 62120c7841
Fix Steam input "crc" errors, and some other Coverity reports of uninitialized scalar variable
- Fixes #88630.
- Fixes #92578.
2024-05-31 09:55:02 +02:00
Rémi Verschelde ce82984b5c
Merge pull request #92544 from dalexeev/gds-fix-const-non-metatype-subscript
GDScript: Fix subscript resolution on constant non-metatype GDScript base
2024-05-30 22:38:36 +02:00
Rémi Verschelde cd53026b2c
Merge pull request #92558 from dalexeev/gds-adjust-inferred-declaration
GDScript: Do not produce `INFERRED_DECLARATION` on type import
2024-05-30 22:13:52 +02:00
Rémi Verschelde 34fe09dda7
Merge pull request #92386 from AThousandShips/goto_fix
[GDScript LSP] Fix `show_native_symbol_in_editor`
2024-05-30 22:13:46 +02:00
Danil Alexeev 3fd30ed4ff
GDScript: Do not produce `INFERRED_DECLARATION` on type import 2024-05-30 19:30:07 +03:00
Danil Alexeev 18d8838051
GDScript: Fix subscript resolution on constant non-metatype GDScript base 2024-05-30 17:37:05 +03:00
Rémi Verschelde 2666955011
Merge pull request #92251 from Chaosus/gdscript_fix_new_argument_completion
Fix completion for `new` arguments
2024-05-30 11:47:54 +02:00
A Thousand Ships e6ab22d450
[GDScript LSP] Fix `show_native_symbol_in_editor` 2024-05-26 16:33:19 +02:00
Yuri Rubinsky fc2b82188b Fix completion for `new` arguments 2024-05-26 13:47:22 +03:00
Danil Alexeev 4b692959de
GDScript: Fix lambdas capturing non-local variables 2024-05-22 10:07:31 +03:00
kobewi eca19d6e80 Fix broken script reloading 2024-05-20 23:54:27 +02:00
Rémi Verschelde c63383fa88
Merge pull request #92035 from rune-scape/rune-gdscript-invalid
GDScript: Fix segfault on invalid script
2024-05-19 11:21:14 +02:00
Rémi Verschelde 4ce95d684c
Merge pull request #91653 from HolonProduction/autocompletion-analyze-recursively-but-leave-the-parser-alone
Autocompletion: Analyze CLASS types as they are encountered
2024-05-19 11:21:11 +02: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 +02:00
rune-scape 9fa13da16f GDScript: fix segfault on invalid script 2024-05-17 15:26:25 -07:00
Danil Alexeev 7dd801c580
GDScript: Fix `STANDALONE_EXPRESSION` warning for `preload()` 2024-05-17 10:33:01 +03:00
Danil Alexeev 0bd4345736
GDScript: Add support for `atr` and `atr_n` to POT generator 2024-05-14 18:35:59 +03:00
Rémi Verschelde bdefe53992
Merge pull request #91909 from KoBeWi/have_fun_reviewing_this
Use Core/Scene stringnames consistently
2024-05-14 12:07:03 +02:00
kobewi 413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
Rémi Verschelde 0a67ee52d1
Revert "GDScript: Implement get_dependencies()"
This reverts commit dc73440f89.

This commit in some form is needed to fix handling of dependencies on
export, but as it's also used for import, it's exposing some pre-existing
issues which we need to solve first.

So reverting for now to give ourselves time to iron this out for a future
Godot release.

Fixes #91726.
2024-05-13 16:59:43 +02:00
Danil Alexeev 76b2d85c9f
GDScript: Fix some export annotation issues 2024-05-13 17:49:06 +03:00
kobewi a262d2d881 Add shorthand for using singleton string names 2024-05-11 18:53:08 +02:00
A Thousand Ships a0dbdcc3ab
Replace `find` with `contains/has` where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
2024-05-08 12:37:42 +02:00
Rémi Verschelde 7d03b1de0b
Style: Trim trailing whitespace and ensure newline at EOF
Found by apply the file_format checks again via #91597.
2024-05-08 10:12:46 +02:00
Rémi Verschelde d83586f1e4
Merge pull request #84492 from HolonProduction/reduce-const-arrays
Autocompletion: Mark datatype as constant for constant arrays
2024-05-07 21:52:40 +02: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 +02:00
Rémi Verschelde 4db9103c2b
Merge pull request #91650 from akien-mga/codespell
Fix various typos with codespell
2024-05-07 13:49:03 +02:00
Rémi Verschelde 0404e3a85e
Merge pull request #84148 from KANAjetzt/fix_crash_take_over_path_named_class
Fix crash when extending taken-over named class
2024-05-07 13:48:36 +02:00
HolonProduction d131064841 Autocompletion: Analyze CLASS types as they are encountered 2024-05-07 10:45:28 +02:00
Rémi Verschelde 4b070e8031
Fix various typos with codespell
Using 2.2.7.dev217+g10c2abcf.

Had to add `colour` to the ignore list as we used it as an alias/keyword for the
documentation of color-related APIs.
Also ignore recommendations to change `thirdparty` to either `third-party` or
`third party`, which are correct but we use the former fairly consistently.
2024-05-07 10:08:42 +02:00
Kai f4192aad6f Fix crash when extending taken-over named class
Added error handling in `_prepare_compilation()` to address cases where the `base_type` cannot be found, preventing a crash.
2024-05-07 08:07:11 +02:00
A Thousand Ships 955d5affa8
Reduce and prevent unnecessary random-access to `List`
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
2024-05-04 16:08:55 +02:00
Rémi Verschelde 03e6fbb010
Merge pull request #85474 from fire/packedvector4array
Add `PackedVector4Array` Variant type
2024-05-03 12:25:26 +02:00
Rémi Verschelde 4d43fe1c96
Merge pull request #91472 from vnen/gdscript-default-static-variables-non-tool
GDScript: Initialize static variables with defaults in-editor
2024-05-03 01:21:40 +02: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 +02:00
George Marques 22236380c0
GDScript: Initialize static variables with defaults in-editor
When the script is not marked as `@tool` the static constructor is not
called and thus the variables contain `null` by default. But since some
validated operations requires a valid value, this would cause a crash.

This commit solves this by initializing the static variables with a
default value based on their types in the editor, when they are not
marked as `@tool`, so if some `@tool` script access them, they will have
a valid typed value, avoiding the crash.
2024-05-02 15:09:22 -03:00
Rémi Verschelde 76f642b962
Merge pull request #91412 from dalexeev/gds-fix-non-static-access-in-static-context
GDScript: Fix access non-static members in static context
2024-05-02 17:31:39 +02:00
Rémi Verschelde a7029e4c8a
Merge pull request #91364 from vnen/gdscript-implicit-ready-base-first
GDScript: Call implicit ready on base script first
2024-05-02 17:31:32 +02:00
George Marques 99b702ea3d
GDScript: Call implicit ready on base script first
It is generally expected that the base class is called before the
inherited clas. This commit implements this behavior for the implicit
ready function (`@onready` annotation) to make it consistent with the
expectations.
2024-05-02 11:25:52 -03:00
Danil Alexeev 8122a27eac
GDScript: Fix access non-static members in static context 2024-05-01 19:55:40 +03:00
A Thousand Ships c4e24d2b3b
[GDScript] Correctly report invalid read-only access 2024-05-01 12:28:47 +02:00
Rémi Verschelde 731ea17dd4
Merge pull request #91192 from vnen/gdscript-validated-native-static-calls
GDScript: Perform validated calls with static methods
2024-05-01 09:55:04 +02:00
Rémi Verschelde 273a643145
Merge pull request #89647 from AThousandShips/read_only_dict
[Core] Fix property access on read-only `Dictionary`
2024-05-01 09:54:48 +02:00
Rémi Verschelde c4733e8003
Merge pull request #90860 from vnen/gdscript-get-dependencies
GDScript: Implement `get_dependencies()`
2024-04-29 12:30:12 +02:00
Rémi Verschelde 296758a8f8
Merge pull request #90552 from vnen/gdscript-constructor-callable-release
GDScript: Assume constructor to be accessible from class
2024-04-29 12:30:08 +02:00
Rémi Verschelde d216a385a6
Merge pull request #90498 from vnen/gdscript-resolve-scene-autoload-types
GDScript: Resolve types from autoload scenes
2024-04-29 12:30:02 +02:00
Rémi Verschelde 13fbd42c37
Merge pull request #90975 from aaronfranke/plugin-org
Organize existing code for editor plugins
2024-04-29 10:09:45 +02:00
Rémi Verschelde c33cd94509
Merge pull request #90949 from rhofour/gdignore
LSP: Have `GDScriptWorkspace::list_script_files` respect `.gdignore`.
2024-04-29 10:09:42 +02:00
Aaron Franke 1bcbbe96c4
Organize existing code for editor plugins 2024-04-27 11:59:58 -07:00
George Marques 8b7fc225f0
GDScript: Resolve types from autoload scenes
When the autoload is a scene, it now extracts the script from it and
use it to further infer nested types.
2024-04-26 10:46:19 -03:00
Danil Alexeev 2778069025
GDScript: Fix object iterator opcodes 2024-04-26 09:21:55 +03:00
George Marques 7ca038effa
GDScript: Perform validated calls with static methods
When the types are validated at compile time, this type of call runs
faster. It is already used for instance methods, this adds this
optimization to native static methods as well.
2024-04-25 21:19:40 -03:00
Danil Alexeev 4136ed7fc8
GDScript: Fix test `reset_uninit_local_vars.gd` failure 2024-04-24 20:49:52 +03:00
Rémi Verschelde 69a23e64e4
Merge pull request #89990 from dalexeev/gds-reset-uninit-local-vars
GDScript: Fix uninitialized local variables not being reset
2024-04-24 18:54:56 +02:00
Rémi Verschelde 6b28cb6721
Merge pull request #89884 from HolonProduction/tests-batch-2
Completion Tests: Add script to owner
2024-04-23 19:10:57 +02:00
Rémi Verschelde 13b66bcea2
Merge pull request #89738 from dalexeev/gds-docgen-improve-non-constant
GDScript: Improve DocGen for non-constant expressions
2024-04-23 19:10:51 +02:00
Rémi Verschelde e8eca0b3f0
Merge pull request #90601 from rune-scape/rune-gdscript-dependant-parser-ref-errors
GDScript: Fix out of date errors in depended scripts
2024-04-22 22:18:15 +02:00
A Thousand Ships ec29c3e784
[Core] Fix property access on read-only `Dictionary` 2024-04-22 13:57:34 +02:00
R. Alex Hofer 2452176990 Have GDScriptWorkspace::list_script_files respect .gdignore. 2024-04-20 13:29:27 -04:00
Rémi Verschelde 931f878390
Merge pull request #88899 from AThousandShips/gdscript_clean
[GDScript] Clean up some unused code
2024-04-19 16:26:58 +02:00
rune-scape 6b88c86cec GDScript: invalidate GDScriptParserRef when reloading 2024-04-18 14:05:58 -07:00
George Marques dc73440f89
GDScript: Implement get_dependencies()
The parser and analyzer now track the dependencies of the script and
return the list when the resource loader ask for them.

What is considered a dependency:

- Any `preload()` call.
- The base script this one extends.
- Any identifier, including types, that refers to global scripts.
- Any autoload singleton reference.
2024-04-18 11:54:37 -03:00
Rémi Verschelde 978d206f34
Merge pull request #90794 from vnen/gdscript-no-unused-constant-warning-with-underscore
GDScript: Suppress unused constant warning with underscore
2024-04-18 15:17:13 +02:00
George Marques a3b3a20ac0
GDScript: Suppress unused constant warning with underscore
The warning message mentions that local constants prefixed with `_` does
not generate the warning. This commit actually implements this warning
suppression.
2024-04-18 09:58:23 -03:00
George Marques f9048fcd7d
GDScript: Warn when enum variable has no default
The default will always be set to `0`, so if it's not a valid value in
the enum, the warning is shown.
2024-04-16 11:46:59 -03:00
A Thousand Ships c070c12ddd
[GDScript] Clean up some unused code 2024-04-16 15:59:38 +02:00
Rémi Verschelde 684e7aa37a
Merge pull request #89472 from dalexeev/gds-fix-bin-tokenizer-continuation-lines
GDScript: Fix continuation lines in `GDScriptTokenizerBuffer`
2024-04-15 18:14:38 +02:00
George Marques 030995c10d
GDScript: Allow casting enum to int
An enum value is always an integer so the cast is valid. The code here
now consider this case to avoid giving an error message.
2024-04-12 11:49:21 -03: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 +02:00
George Marques e761982979
GDScript: Assume constructor to be accessible from class
Since the constructor is accessed directly from the class, even if not
marked `static`, it can be retrieved as a Callable without an instance.
2024-04-11 20:28:46 -03:00
Rémi Verschelde 67076c167d
Merge pull request #90448 from vnen/gdscript-infer-string-format
GDScript: Infer type with string format operator
2024-04-10 17:49:49 +02:00
Rémi Verschelde 8611fd8400
Merge pull request #90442 from vnen/gdscript-dont-warn-using-default-builtin
GDScript: Don't warn on unassigned for builtin-typed variables
2024-04-10 17:49:44 +02: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 -03:00
George Marques 4bdba718c5
GDScript: Infer type with string format operator
If the left value type is known to be String, assume the format operator
(`%`) will return a string, since it works with any type in the right
hand side. This is also used by type inference even if the right hand
type is unknown at compile time.
2024-04-10 11:49:30 -03:00