Commit Graph

3252 Commits

Author SHA1 Message Date
A Thousand Ships 684752e75b
Replace error checks against `size` with `is_empty` 2024-02-09 12:50:15 +01: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 -03: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 -03:00
Rémi Verschelde 41564aaf77
Merge pull request #86999 from AThousandShips/init_note
Improve error message when a GDScript instance fails to be constructed
2024-02-08 13:49:44 +01: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 +01:00
Rémi Verschelde 50491db048
Merge pull request #88071 from Calinou/gdscript-nodepath-autocomplete-fix-identifiers
Fix NodePath autocompletion to ensure paths are quoted when required
2024-02-08 10:54:12 +01:00
Hugo Locurcio 1238b60b22
Fix NodePath autocompletion to ensure paths are quoted when required
Every component of the path is now checked to be a valid identifier,
so that node names that start with a digit always require the full
path to be quoted.
2024-02-07 19:26:55 +01:00
Yuri Rubinsky 1d75480082 Fix autocompletion for enum members in the core classes 2024-02-07 20:42:06 +03:00
Rémi Verschelde 7223c5b54a
Fix various typos with codespell
Using 2.2.7.dev115+g0eb441d6.

Had to add `cancelled` to the ignore list, as it's a Wayland signal which
we're handling in our code, so we don't want codespell to fix that "typo".

Also includes the typo fix from #87927.

Co-authored-by: Divyanshu Shekhar <61140213+divshekhar@users.noreply.github.com>
2024-02-07 11:09:34 +01:00
Rémi Verschelde 888299d6f7
Merge pull request #87939 from dalexeev/gds-add-is-not-operator
GDScript: Add `is not` operator
2024-02-07 11:01:19 +01:00
Rémi Verschelde 9cfd6dbab2
Merge pull request #87783 from AThousandShips/utility_err
Make `GDScriptUtilityCallable` return call error when method is invalid
2024-02-07 10:59:17 +01:00
HolonProduction 6df1a1e9b0 Autocompletion: mark datatype as constant for constant arrays 2024-02-05 20:26:43 +01:00
Rémi Verschelde 2f9ea3a505
Merge pull request #87941 from AThousandShips/num_fix
[GDScript] Prevent running `String` number functions on invalid literal
2024-02-05 14:53:23 +01:00
Danil Alexeev 2bf25954b4
GDScript: Add `is not` operator 2024-02-04 17:36:53 +03:00
A Thousand Ships 66d55e62f0
[GDScript] Prevent running `String` number functions on invalid literal
Prevents printing excessive errors.
2024-02-04 14:35:22 +01:00
A Thousand Ships f4f7e13388
Make `GDScriptUtilityCallable` return call error when method is invalid 2024-01-31 15:59:37 +01:00
Aaron Franke aed5ea9460
Expose a method to get gravity for any physics body 2024-01-30 23:57:38 -06:00
Rémi Verschelde 926a7dffd6
Merge pull request #87421 from dalexeev/gds-docgen-use-autoload-singleton-name
GDScript: Use autoload singleton name in `GDScriptDocGen`
2024-01-30 17:47:58 +01:00
Rémi Verschelde 9572cf5ab2
Merge pull request #86823 from dalexeev/gds-utility-func-as-callable
GDScript: Allow utility functions to be used as `Callable`
2024-01-30 17:47:50 +01:00
Rémi Verschelde 1f027f9aef
Merge pull request #86471 from dalexeev/gds-fix-pot-gen-skips-some-nodes-2
GDScript: Fix POT generator skips some nodes (part 2)
2024-01-30 17:47:44 +01:00
Rémi Verschelde a8cfd1436a
Merge pull request #86176 from dalexeev/gds-fix-type-highlighting
GDScript: Fix type highlighting
2024-01-30 17:47:33 +01:00
Rémi Verschelde 2edfdace76
Merge pull request #83220 from dalexeev/gds-highlight-code-regions
GDScript: Highlight code region comments
2024-01-30 17:47:23 +01: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 +01:00
Rémi Verschelde fa48a51183
Merge pull request #87688 from AThousandShips/what_is_this
Remove unnecessary `this->` expressions
2024-01-29 13:18:09 +01:00
Yuri Sizov d644b9b640 Better hide internal properties from users 2024-01-29 12:35:10 +01:00
A Thousand Ships 15369fdb1d
Remove unnecessary `this->` expressions 2024-01-29 09:59:18 +01:00
Danil Alexeev faebb0895f
GDScript: Highlight code region comments 2024-01-25 22:03:48 +03:00
Yuri Sizov 9579dc6313 Merge pull request #85239 from HolonProduction/global-class-property-location
Handle global classes when resolving property location
2024-01-25 16:26:50 +01:00
HolonProduction c99e4f862f Handle global classes when resolving property location 2024-01-24 18:05:47 +01:00
Yuri Sizov 72756133e0 Merge pull request #85224 from HolonProduction/identifier-type-prefer-annotated
Prefer identifiers annotated type if assigned type is incompatible to it
2024-01-24 14:07:52 +01:00
Danil Alexeev 5e7cda3405
GDScript: Use autoload singleton name in `GDScriptDocGen` 2024-01-21 11:28:23 +03:00
Rémi Verschelde 0bcc0e92b3
Merge pull request #86730 from reduz/64-bit-cowdata
Promote CowData to 64 bits
2024-01-19 18:46:11 +01:00
Juan Linietsky 24fe0715b5 Promote CowData to 64 bits
Fixes a lot of bugs, please help me fill the list.
2024-01-19 17:41:10 +01:00
Rémi Verschelde baf87e2717
Merge pull request #87294 from vnen/allow-free-callable
Allow `free()` to be used as Callable
2024-01-18 16:35:14 +01:00
Rémi Verschelde 33f3511241
Merge pull request #87293 from YuriSizov/editor-theme-a-rehashed-follow-up
Improve editor theme generation after the refactor
2024-01-18 16:34:50 +01:00
Rémi Verschelde d3003c48b3
Merge pull request #67132 from KoBeWi/This_commit_message_is_auto-generated._Do_not_modify_it-
Add UID support to GDScript files
2024-01-18 16:33:14 +01:00
George Marques b4e08eb752
Allow `free()` to be used as Callable
This method is registered in a special way so ClassDB doesn't naturally
know about its existence. Here it is hardcoded if any other option fail
to check if it is about the `free()` method and, if so, say it exists
and return a Callable.
2024-01-18 09:33:44 -03:00
Rémi Verschelde b5dcb5f58a
Merge pull request #85215 from HolonProduction/type-from-property-class-name
Handle global classes when resolving type from `PropertyInfo`
2024-01-18 09:33:22 +01:00
HolonProduction 0203b3c310 Prefer identifiers annotated type if assigned type is incompatible to it 2024-01-17 22:32:00 +01:00
kobewi c7f68a27ec Add UID support to GDScript files 2024-01-17 22:30:56 +01:00
HolonProduction 4ab985d138 Handle global classes when resolving type from `PropertyInfo` 2024-01-17 21:39:51 +01:00
Yuri Sizov b6a2c78033 Merge pull request #87286 from akien-mga/fix-preprocessor-if-ENABLED-checks
Fix `#if *_ENABLED` inconsistencies, should check if defined
2024-01-17 18:53:33 +01:00
Yuri Sizov dc729f1614 Merge pull request #87278 from HolonProduction/give-those-autoloads-an-upgrade
Handle GDScript in `_type_from_variant` for autocompletion
2024-01-17 18:53:25 +01:00
Yuri Sizov 2dd7808757 Merge pull request #86961 from HolonProduction/completion-tests-fixup
Allow specifying a scene in completion tests
2024-01-17 18:53:03 +01:00
Yuri Sizov c027aecc2e Merge pull request #86676 from rune-scape/sparse-script-reload
GDScript: Hot-reload changed scripts only
2024-01-17 18:52:54 +01:00
Yuri Sizov 5b22884b4a Merge pull request #86554 from HolonProduction/lookup-subscript
Fix symbol lookup in index subscript
2024-01-17 18:52:49 +01:00
Yuri Sizov 28cf7fe2f6 Merge pull request #85384 from HolonProduction/unique-name-completion
Suggest scene unique nodes in `get_node` autocompletion
2024-01-17 18:52:31 +01:00
Yuri Sizov 45eedba1fa Improve editor theme generation after the refactor 2024-01-17 15:16:53 +01:00
Rémi Verschelde 0a7579b161
Fix `#if *_ENABLED` inconsistencies, should check if defined
Co-authored-by: Caroline Joy Bell <halotroop2288@proton.me>
2024-01-17 10:30:15 +01:00
HolonProduction 6af45c6ef2 Handle GDScript in `_type_from_variant` for autocompletion 2024-01-16 23:04:10 +01:00
Ricardo Subtil a06e5f70bc Simplify script paths to ensure proper resource path checks 2024-01-12 17:53:59 +00:00
kobewi 0e8f90f4c8 Update deferred calls to use Callables 2024-01-09 16:11:47 +01:00
A Thousand Ships cae3b822c3
Improve error message when a GDScript instance fails to be constructed
Co-authored-by: Slashscreen <SlashScreen@users.noreply.github.com>
2024-01-09 13:32:22 +01:00
Rémi Verschelde 1edcf9a405
Merge pull request #81345 from anvilfolk/gdoverview
GDScript: Add module description in markdown
2024-01-09 11:27:05 +01:00
HolonProduction 92a7c26806 Allow specifying a scene in completion tests 2024-01-08 22:38:41 +01:00
Rémi Verschelde b88535fe23
Merge pull request #85178 from HolonProduction/completion-tests
Add unit test runner for autocompletion
2024-01-08 11:51:03 +01:00
Danil Alexeev b31acb0cd5
GDScript: Allow utility functions to be used as `Callable` 2024-01-05 21:16:53 +03:00
Muller-Castro 96a95cb974 Add const lvalue ref to container parameters 2024-01-05 14:49:57 -03:00
HolonProduction af4cbaf751 Add unit test runner for autocompletion 2024-01-05 17:49:51 +01:00
Rémi Verschelde bf1de980e5
Merge pull request #86569 from rune-scape/rune-fix-lambda-hotswap2
GDScript: Lambda hotswap fixes
2024-01-05 12:05:32 +01:00
rune-scape 49bce5c9ef GDScript: Lambda hotswap fixes 2024-01-04 16:33:54 -08: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 +01:00
Rémi Verschelde 2bffa3cbc5
Merge pull request #82639 from golfinq/gdscript-improve-indexing-error
GDScript: Improve error messages for invalid indexing
2024-01-04 16:38:58 +01:00
Rémi Verschelde 525e0bb37c
Merge pull request #86667 from HolonProduction/completion-enum-sorting
Improve sorting of enum autocompletion
2024-01-04 14:26:25 +01: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 +01:00
Rémi Verschelde 8be3c4b73f
Merge pull request #86341 from Vilcrow/fix-self-completion
Fix the autocomplete function for the 'self' keyword.
2024-01-03 10:00:19 +01:00
rune-scape cde478bda6 Hot-reload only changed scripts 2024-01-02 17:56:52 -08:00
S.V.I. Vilcrow c8fc824608 Fix the autocomplete function for the 'self' keyword. 2024-01-02 20:47:41 +03:00
Rémi Verschelde 2e1725bef6
Merge pull request #86088 from dalexeev/gds-fix-static-func-as-callable-in-static-context
GDScript: Fix accessing static function as `Callable` in static context
2024-01-02 18:05:16 +01:00
Rémi Verschelde b5c6e870e8
Merge pull request #82264 from dalexeev/core-builtin-methods-as-callables
Core: Allow methods of built-in `Variant` types to be used as Callables
2024-01-02 18:05:05 +01:00
Rémi Verschelde 06bb9f28e7
Merge pull request #86704 from AThousandShips/len_fix
[GDScript] Add `StringName` support to `@GDScript.len`
2024-01-02 15:09:09 +01:00
A Thousand Ships 045d921044 [GDScript] Add `StringName` support to `@GDScript.len` 2024-01-02 14:28:34 +01:00
EddieBreeg 8747c67d9e
Fix potential integer underflow in rounded up divisions
A new `Math::division_round_up()` function was added, allowing for easy
and correct computation of integer divisions when the result needs to
be rounded up.

Fixes #80358.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-01-02 14:14:47 +01:00
HolonProduction 76fd7ec394 Improve sorting of enum autocompletion 2023-12-31 14:35:08 +01:00
HolonProduction 54742f7c60 Fix symbol lookup in index subscript 2023-12-27 17:46:17 +01:00
rune-scape e4242f9b40 GDScript: Include lambda dependencies 2023-12-26 13:02:03 -08:00
Danil Alexeev e07ec89bdf
GDScript: Fix POT generator skips some nodes (part 2) 2023-12-23 20:55:16 +03:00
Yuri Sizov fc082dd735 Merge pull request #86091 from dalexeev/gds-fix-pot-gen-skips-some-nodes
GDScript: Fix POT generator skips some nodes
2023-12-19 20:33:09 +01:00
msreis f1cc14d525 Fix missing time for some script functions in profiler
Fixes the issue by adding a mechanism by which the functions that were
previously disappearing can be profiled too. This is optional with
an editor setting, since collecting more information naturally slows the engine
further while profiling.

Fixes #23715, #40251, #29049
2023-12-19 19:42:21 +01:00
Danil Alexeev 3a3a2011f4
GDScript: Add `@export_storage` annotation 2023-12-19 20:56:30 +03:00
Yuri Sizov 38d8ca0dc1 Merge pull request #85703 from TitanNano/jovan/gdscript_foreign_script_properties
Make GDScriptAnalyzer aware of properties from other languages
2023-12-19 13:02:19 +01: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 +01:00
Jovan Gerodetti 030aa41a99 GDScriptAnalyzer is unaware of properties from other Languages
Co-authored-by: K. S. Ernest (iFire) Lee <fire@users.noreply.github.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-12-18 22:03:30 +01:00
Wilson E. Alvarez a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
Yuri Sizov f4b32b228a Merge pull request #85603 from eldidou/speed-up-get-must-clear-dependencies
Speed up `GDScript::get_must_clear_dependencies()`
2023-12-16 17:49:47 +01:00
Yuri Sizov 4b258ccdd3 Merge pull request #82884 from KoBeWi/commit_message_cached,_please_refresh
Clarify some descriptions regarding resource cache
2023-12-16 17:49:20 +01:00
Danil Alexeev 3a4a0c6b15
GDScript: Fix type highlighting 2023-12-14 23:38:24 +03:00
Yuri Sizov 203c8c31d3 Merge pull request #85071 from Rubonnek/remove-unnecessary-assignments
Remove unnecessary assignments
2023-12-14 17:38:34 +01:00
Yuri Sizov 5c99558d16 Merge pull request #76591 from HolonProduction/complete-tween
Autocomplete properties in `tween_property`
2023-12-14 17:37:53 +01:00
Wilson E. Alvarez 80fb8db31f
Remove unnecessary assignments
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-12-13 11:06:26 -05:00
Danil Alexeev 1aa242f7c4
GDScript: Fix POT generator skips some nodes 2023-12-13 13:06:59 +03:00
HolonProduction 5f72254d4d Fix regression when autocompleting subscript on get node 2023-12-13 10:54:40 +01:00
Danil Alexeev 10dcb21d8b
GDScript: Fix accessing static function as `Callable` in static context 2023-12-12 22:19:39 +03:00
kobewi a1aa1a468f Clarify some descriptions regarding resource cache 2023-12-10 20:30:01 +01:00
eldidou 0d77c3e092 Speed up GDScript::get_must_clear_dependencies()
get_must_clear_dependencies() has a N^3*log(N) time complexity, and this can very quickly slow down the quitting process as more gdscripts are added in a project.
This change improves it to N^2*log(N).
Instead of using all the inverted dependencies, we do the same with all (non-inverted) dependencies, which is N times faster.

Fixes #85435
2023-12-09 13:02:38 +01:00
Yuri Sizov 3b9347d5b2 Merge pull request #81662 from Repiteo/container-type-vector
Change GDScriptDataType `container_element_type` to vector container
2023-12-08 16:57:53 +01:00
Thaddeus Crews 5cf0d772bc
Change container_element_type to vector container 2023-12-05 08:51:49 -06:00
Rémi Verschelde 7c8dfea9e3
Merge pull request #85196 from HolonProduction/completion-filter-groups
Filter groups and categories from autocompletion
2023-12-05 13:05:18 +01:00
Rémi Verschelde dc367bec38
Merge pull request #79386 from HolonProduction/completion-get-child-static
Improve autocompletion with `get_node`
2023-12-05 13:05:11 +01:00
Rémi Verschelde d75c44658c
Merge pull request #85373 from DmitriySalnikov/update_singletons
Fix updating cached singletons when reloading GDScripts
2023-12-04 23:13:13 +01:00
Rémi Verschelde 3e7cc5ec32
Merge pull request #85271 from YuriSizov/core-check-please!
Correctly check scripts that must inherit `EditorPlugin`
2023-12-04 23:12:24 +01:00
HolonProduction c8889a7fe7 Improve autocompletion with get_node 2023-12-04 17:06:46 +01:00
HolonProduction e253250814 Filter groups and categories from autocompletion 2023-12-04 15:48:29 +01:00
DmitriySalnikov 8cdbec0434 Update cached singletons when reloading GDScripts 2023-11-30 04:07:21 +03:00
Jordyfel ef5dcccde7 Stop caching packed scenes in GDScript cache 2023-11-29 12:52:55 +02:00
Mika Viskari d168dada36 Moving 'Expected indented block' error message lines numbers back 2023-11-28 23:09:11 +02: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 -03:00
Pedro J. Estébanez cfa7e72057 Fix GDScript thread-exit routine assuming thread-enter was called 2023-11-27 13:01:37 +01:00
HolonProduction 8cc85515af Suggest scene unique nodes in `get_node` autocompletion 2023-11-26 15:41:29 +01:00
Pedro J. Estébanez bfe66ab7cd Fixup thread-owned lambda bookkeeping on thread exit (take 2) 2023-11-23 18:50:20 +01:00
Yuri Sizov bc1949d797 Correctly check scripts that must inherit `EditorPlugin`
Also updates some error messages related to this kind of check
across the codebase.
2023-11-23 16:24:43 +01:00
Pedro J. Estébanez f26328e9a3 Revert recently added approach to cross-thread lambda survival
Commits reverted:
- 1ed6919148
- 271511726b
2023-11-22 20:07:01 +01:00
Rémi Verschelde c2f8fb3015
Merge pull request #85039 from RandomShaper/mingwthreads
Use mingw-std-threads in MinGW builds
2023-11-21 15:44:18 +01:00
Rémi Verschelde fa259a77cd
Codestyle: Fix some comment issues 2023-11-21 15:26:53 +01:00
Pedro J. Estébanez 1ed6919148 Fix leak in the bookkeeping of GDScript lambdas 2023-11-21 12:52:55 +01:00
HolonProduction 4883a12a13 Autocomplete properties in tween_property 2023-11-19 22:18:06 +01:00
Pedro J. Estébanez fe4850c0d0 Use mingw-std-threads in MinGW builds 2023-11-18 11:56:05 +01:00
Rémi Verschelde bc80776618
Merge pull request #84659 from RandomShaper/fix_lambda_cross_thread
Fix lambda cross-thread dynamics
2023-11-12 12:14:42 +01:00
Rémi Verschelde 8928b2044b
Merge pull request #80281 from KoBeWi/unacceptable
Assign temporary path to preloaded resources
2023-11-12 12:13:55 +01:00
Rémi Verschelde a9c864dc35
Merge pull request #83039 from KoBeWi/it's_always_the_cache
Fix GDScript cache assigning UID as scene path
2023-11-10 10:44:33 +01:00
kobewi a3627b6e37 Assign temporary path to preloaded resources 2023-11-10 00:43:30 +01:00
Pedro J. Estébanez 271511726b Fixup thread-owned lambda bookkeeping on thread exit 2023-11-10 00:05:38 +01:00
Rémi Verschelde bfd7a50036
SCons: Fix build with GDScript LSP disabled
Fixes #83947.
2023-10-30 15:28:34 +01:00
Danil Alexeev 6e996a597f
GDScript: Fix `UNSAFE_CAST` warning 2023-10-27 12:42:00 +03:00
Rémi Verschelde adcd16c710
Merge pull request #83569 from vnen/gdscript-no-opt-division-modulo
GDScript: Don't optimize division and modulo on debug
2023-10-26 15:59:44 +02:00
Danil Alexeev b04263644c
Core: Allow methods of built-in `Variant` types to be used as Callables 2023-10-25 15:53:52 +03:00
ryanabx e945a8fbad Fix typo in gdscript_parser.h and gdscript_translation_parser_plugin.cpp 2023-10-23 08:48:36 -05:00
Danil Alexeev 7f4721a941
GDScript: Fix non-static call is allowed in static var lambda body 2023-10-20 20:43:07 +03:00
Rémi Verschelde 7270da76ba
Merge pull request #83540 from mattbork/get_shallow_script_fix
Fix `GDScriptCache::get_full_script` eating parsing errors because of early exit
2023-10-20 15:09:04 +02:00
Matthew Borkowski 2d262c072b Fix `GDScriptCache::get_full_script` eating parsing errors because of early exit
Fixes #75545.
2023-10-18 18:21:59 -04:00
George Marques 08e3f30299
GDScript: Don't optimize division and modulo on debug
Since the validated operators don't have checks for division by zero,
use the regular evaluator in debug which has those checks.
2023-10-18 14:12:51 -03:00
rune-scape 9fb8862d73
GDScript: Lambda hot reloading
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
2023-10-17 15:52:52 -04:00
Rémi Verschelde 109cb8e697
Merge pull request #83455 from Lunarisnia/fix/gdscript-error-typo
Fix grammar typo in GDScript error message
2023-10-17 16:13:02 +02:00
Lunarisnia 981c6c94c0 Fix grammar typo in GDScript error message 2023-10-17 01:33:37 +07:00
Rémi Verschelde ddb7969cb6
Merge pull request #83257 from dalexeev/gds-fix-unresolved-type-for-incomplete-expressions
GDScript: Fix unresolved datatype for incomplete expressions
2023-10-16 18:44:27 +02:00
Rémi Verschelde 6a0716dedd
Merge pull request #83123 from astillich/82998-propagate-base-class-exports
Fix modifying base script exports not propagating to derived scripts
2023-10-16 18:43:39 +02:00
Alexander Stillich 99f8751878 Fix editing exports in a base script not propagating the change to the opened property editor
This patch fixes the user having to navigate away from the selected node which has the derived script attached and back to see the changes of the base script exports reflected in the property editor.
2023-10-16 17:55:19 +02:00
Danil Alexeev 0c2202c56e
GDScript: Fix incorrect error message for utility functions 2023-10-16 14:09:57 +03:00
ocean (they/them) f870711739 GDScript: add module description in markdown 2023-10-13 10:46:24 -04:00
Danil Alexeev 3ac61aadd7
GDScript: Fix unresolved datatype for incomplete expressions 2023-10-13 12:52:14 +03:00
Danil Alexeev 881fe67d94
Code Editor: Fix regression with using doc comments for code regions 2023-10-13 09:38:03 +03:00
Rémi Verschelde 2c79bc686e
Merge pull request #83150 from dalexeev/gds-autocomplete-static-var-on-class
GDScript: Add autocompletion for static variables accessed via class
2023-10-11 22:44:35 +02:00
Rémi Verschelde 25fa5eadd5
Merge pull request #82986 from OmarShehata/fix-external-editor-hot-reload
Fix external editor hot reload for GDScript
2023-10-11 22:38:42 +02:00
Danil Alexeev 496bee3bc7
GDScript: Add autocompletion for static variables accessed via class 2023-10-11 17:10:16 +03:00
Danil Alexeev 668ba2d1a5
GDScript: Allow empty parentheses for property getter declaration 2023-10-11 09:54:17 +03: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 +02:00
Rémi Verschelde 7f5be552ec
Merge pull request #83049 from dalexeev/gds-docgen-fix-return-metatype-regression
GDScript DocGen: Fix regression with return metatypes
2023-10-10 12:33:34 +02:00
Rémi Verschelde 71a8ac41fb
Merge pull request #72751 from dalexeev/doc-comment-color
Highlight doc comments in a different color
2023-10-09 23:21:54 +02: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 +03:00
Danil Alexeev faa066f9e5
GDScript DocGen: Fix regression with return metatypes 2023-10-09 17:38:54 +03:00
kobewi 6849cf48d1 Fix GDScript cache assigning UID as scene path 2023-10-09 13:57:31 +02:00
Danil Alexeev de7cbe8789
Highlight doc comments in a different color 2023-10-08 19:26:10 +03:00
A Thousand Ships f18aa00e85 Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-10-08 17:23:33 +02:00
Omar Shehata c25a2d832b Fix external editor hot reload 2023-10-07 22:14:54 -04:00
George Marques 4a7d49a89a
GDScript: Replace ptrcalls on MethodBind to validated calls
This improves the performance of typed calls to engine methods when the
argument types are exact.

Using validated calls delegate more of the work the core instead of
doing argument unpacking in the VM. It also does not need different
instructions for each return type, simplifying the code.
2023-10-06 11:15:44 -03:00
Rémi Verschelde 1edf0f35b1
Merge pull request #82326 from adeneve/gdscript_dict_highlighter_fix
Fix for GDScriptHighlighter dictionaries as function arguments
2023-10-05 22:49:47 +02:00
Andrew de Neve 978fcaf1b4 Fix for gdscript_highlighter dictionaries as arguments
Fix for gdscript_highlighter. When passing a dictionary
as a function argument, the dictionary values were being
highlighted green as if they were types.
2023-10-05 12:38:39 -07:00
Danil Alexeev 9e2273abc7
GDScript: Add error when exporting node in non [Node]-derived classes 2023-10-05 13:50:26 +03:00
Rémi Verschelde 7c1abe8599
Merge pull request #82789 from dalexeev/gds-fix-unresolved-type-for-incomplete-bin-op
GDScript: Fix unresolved datatype for incomplete binary operator
2023-10-05 10:10:33 +02:00
Rémi Verschelde a05c800a56
Merge pull request #82784 from dalexeev/gds-fix-empty-native-class
GDScript: Fix `native_type` is empty for autoload without script
2023-10-05 10:10:09 +02:00
Rémi Verschelde 5cee7b0264
Merge pull request #82767 from dalexeev/core-make-object-has-method-virtual
Core: Fix `Object::has_method()` for script static methods
2023-10-05 10:09:45 +02:00
Rémi Verschelde b9bf46de9e
Merge pull request #82067 from dalexeev/gds-docgen-fix-metatypes-and-values
GDScript DocGen: Fix and improve appearance of metatypes and values
2023-10-05 10:07:43 +02:00
Danil Alexeev ed0b3c08e1
Core: Fix `Object::has_method()` for script static methods 2023-10-04 19:44:32 +03:00
Danil Alexeev 2c5636c135
GDScript: Fix unresolved datatype for incomplete binary operator 2023-10-04 17:07:37 +03:00
Rémi Verschelde 1e544505be
Merge pull request #82691 from YuriSizov/rst-validate-with-exceptions
Validate `code` tags for class and member references
2023-10-04 15:42:42 +02:00
Danil Alexeev 6767de9b69
GDScript: Fix `native_type` is empty for autoload without script 2023-10-04 16:09:18 +03:00
Rémi Verschelde e41582f42f
Merge pull request #82547 from dalexeev/gds-fix-unsafe-call-arg-variant-constructors
GDScript: Fix `UNSAFE_CALL_ARGUMENT` warning for `Variant` constructors
2023-10-03 17:25:28 +02:00
Rémi Verschelde 2af3229ce7
Merge pull request #82516 from dalexeev/gds-improve-hl-types
GDScript: Improve highlighting of types
2023-10-03 17:24:32 +02:00
Rémi Verschelde 6de06138c0
Merge pull request #79425 from vnen/gdscript-load-classes-for-debug-tests
GDScript: Load global classes when running debug tests
2023-10-03 17:11:01 +02:00
Danil Alexeev e750c59cf8
GDScript: Improve highlighting of types 2023-10-03 17:32:27 +03:00
Yuri Sizov cc0eebd9d8 Validate `code` tags for class and member references
This commit also adds means to manually disable warnings
in `code` tags where it's a false positive with the new
`skip-lint` attribute.

Warnings are now enabled on CI to prevent future errors.
2023-10-03 15:48:31 +02:00
Rémi Verschelde 5efbed51cc GDScript: Improve error messages for invalid indexing
These errors are very common when using an invalid property name
or calling on an object of the wrong type, and the previous message
was a bit cryptic for users.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Co-authored-by: golfinq <golfinqz@gmail.com>
2023-10-02 14:23:11 -04:00
Jakub Janšta 74c937079c Add type_string() utility 2023-10-02 17:41:20 +02:00
Danil Alexeev ba96d4f631
GDScript: Fix `UNSAFE_CALL_ARGUMENT` warning for `Variant` constructors 2023-09-30 13:57:09 +03:00
Danil Alexeev aff767ef07
Fix expected argument count for `Callable` call errors 2023-09-29 20:00:10 +03:00
Yuri Sizov b25f1f9c79 Merge pull request #82477 from dalexeev/gds-covariance-and-contravariance
GDScript: Add return type covariance and parameter type contravariance
2023-09-28 20:04:37 +02:00
Yuri Sizov 78483a1df2 Merge pull request #82186 from dalexeev/gds-fix-property-duplication
GDScript: Fix duplication of inherited script properties
2023-09-28 20:04:18 +02:00
Yuri Sizov 73252669b1 Merge pull request #82030 from dalexeev/gds-make-for-loop-array-literal-typed
GDScript: Make array literal typed if `for` loop variable type is specified
2023-09-28 20:04:12 +02: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 +02:00
Danil Alexeev cb8b89fd95
GDScript: Add return type covariance and parameter type contravariance 2023-09-28 12:27:36 +03:00
Yuri Sizov aa474c9feb Merge pull request #75988 from dalexeev/gds-unsafe-call-argument
GDScript: Improve call analysis
2023-09-27 19:07:46 +02: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 -03:00
A Thousand Ships 517e9f8aef [Modules] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-26 16:44:52 +02:00
Rémi Verschelde 9b0b441cf3
Merge pull request #82139 from dalexeev/gds-add-inferred-declaration-warning
GDScript: Add `INFERRED_DECLARATION` warning
2023-09-26 16:36:39 +02:00
Chia-Hsiang Cheng ceda13720b Check if any global script class is shadowed by a variable 2023-09-26 16:47:17 +08:00
Rémi Verschelde 0c626bdfb0
Merge pull request #82294 from dalexeev/gds-fix-gdsnc-crash
GDScript: Fix crash with `GDScriptNativeClass`
2023-09-26 08:31:26 +02:00
Rémi Verschelde e4cfd4e26a
Merge pull request #82195 from AThousandShips/radian_fix
Replace `radians` range hint with `radians_as_degrees`
2023-09-25 17:18:38 +02:00
Rémi Verschelde 3e15c8f285
Merge pull request #81833 from 0x4448/fix-autocomplete-quotes
Fix autocomplete quotes
2023-09-25 17:18:23 +02:00
Rémi Verschelde 7a29189858
Merge pull request #81200 from RandomShaper/gd_vm_msvc
Optimize GDScript VM codegen for MSVC
2023-09-25 17:18:19 +02:00
Rémi Verschelde d759f91f8d
Merge pull request #81101 from 398utubzyt/dotnet/abstract-class-support
C#: Add abstract class support
2023-09-25 17:18:05 +02:00
Rémi Verschelde 1a0e653d7f
Merge pull request #78573 from dalexeev/editor-create-script-class-name
Editor: Remove unused Class Name field from Create Script dialog
2023-09-25 17:17:46 +02:00
Pedro J. Estébanez 9c15e2f24b Optimize GDScript VM codegen for MSVC 2023-09-25 16:32:36 +02:00
Danil Alexeev 16b024ba82
GDScript: Fix crash with `GDScriptNativeClass` 2023-09-25 17:09:20 +03:00
A Thousand Ships e45927b2f2 Replace `radians` range hint with `radians_as_degrees` 2023-09-25 08:50:19 +02:00
Danil Alexeev 16e860bcb3
GDScript: Fix duplication of inherited script properties 2023-09-23 15:30:23 +03:00
Danil Alexeev 4ce27301d3
GDScript: Add `INFERRED_DECLARATION` warning 2023-09-22 23:13:52 +03:00
Danil Alexeev 10b00bc2ea
GDScript: Prevent constructing and inheriting engine singletons 2023-09-22 17:30:00 +03:00
0x4448 7ea4247c3d Omit quotes from completion if triggered with quote
Typing a single or double quote in an external editor triggers
auto-completion. The returned CompletionItem should not include
quotes since they're already in the editor.

CompletionParams was missing context in to_json() and this is
required to detect whether a quote was typed.
2023-09-21 17:37:32 -07:00
Danil Alexeev 426ccba70e
GDScript DocGen: Fix and improve appearance of metatypes and values 2023-09-21 20:44:34 +03: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 +03:00
Danil Alexeev 3c35e7f1d6
GDScript: Make array literal typed if `for` loop variable type is specified 2023-09-21 11:25:59 +03:00
Rémi Verschelde 888d3252ba
Merge pull request #81881 from lotuspar/patch-1
Rewrite a small comment in GDScript tokenizer code
2023-09-20 13:09:44 +02: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 +02:00
Rémi Verschelde 712ebe7d8a
Merge pull request #81332 from dalexeev/gds-fix-update-array-literal-in-weak-context
GDScript: Don't make array literal typed in weak type context
2023-09-20 13:09:23 +02:00
Rémi Verschelde 971f678442
Merge pull request #79510 from dalexeev/gds-fix-const-non-metatype-subscript
GDScript: Fix subscript resolution for constant non-metatypes
2023-09-20 13:09:17 +02:00
Rémi Verschelde 21b132616b
Merge pull request #74995 from dalexeev/gds-r-strings
GDScript: Add raw string literals (r-strings)
2023-09-20 13:09:13 +02:00
Danil Alexeev c35cb51d74
GDScript: Fix subscript resolution for constant non-metatypes 2023-09-19 22:26:06 +03:00
Gio b6f1dbb340 Rewrite a bit of comment in tokenizer code
gdscript_tokenizer.cpp: `change` -> `changes`
2023-09-19 21:38:52 +08:00
Rémi Verschelde e207595de9
Merge pull request #81844 from ryanabx/features/specify-lsp-port
Add `--lsp-port` as a command line argument
2023-09-19 09:04:30 +02:00
ryanabx a5b7c4c415 Add `--lsp-port` as a command line argument 2023-09-18 08:51:15 -05:00
ocean (they/them) 729c9b4d4b GDScript: Add check for `super()` methods not being implemented 2023-09-17 16:21:28 -04:00
Rémi Verschelde c63e0aefcf
Merge pull request #79366 from dalexeev/gds-signal-info-and-callback
Editor: Improve signal callback generation
2023-09-17 14:45:47 +02:00
Rémi Verschelde 6c1be30836
Merge pull request #81605 from dalexeev/gds-fix-some-lambda-bugs
GDScript: Fix some lambda bugs
2023-09-16 21:23:42 +02:00
Rémi Verschelde e5ac7cf034
Merge pull request #81577 from anvilfolk/thecycleeeeeeeeeeeeesaaaaaaaaaaaaah
GDScript: Fix compilation of expressions compiling other classes
2023-09-16 21:23:18 +02:00
Danil Alexeev 072e9c5c82
GDScript: Fix and improve doc comment parsing 2023-09-16 17:31:50 +03:00
398utubzyt 2df37a237a C#: Abstract script class support 2023-09-15 20:35:25 -07:00
Danil Alexeev d991cc4998
GDScript: Fix POT generator crash on assignee with index 2023-09-14 17:41:05 +03:00
Yuri Sizov 1437b3a226 Merge pull request #81599 from ShadowApex/shadowapex/fix-extendparser-signals
Fix dumping of signal API parameters
2023-09-14 15:21:56 +02:00
Danil Alexeev b1eb737719
GDScript: Fix some lambda bugs 2023-09-14 14:22:23 +03:00
William Edwards 188132884d Fix dumping of signal API parameters 2023-09-12 18:43:31 -07:00
ryanabx ceda960131 Remove REDUNDANT_FOR_VARIABLE_TYPE
Remove REDUNDANT_FOR_VARIABLE_TYPE
2023-09-12 20:04:32 -05:00
ocean (they/them) d330f5642e GDScript: Fix compilation of expressions compiling other classes
This PR is part of ongoing work on fixing cyclic dependencies in the GDScript
compiler.
2023-09-12 11:18:33 -04:00
Danil Alexeev 26ce861910
Editor: Remove unused Class Name field from Create Script dialog 2023-09-12 12:49:56 +03:00
Rémi Verschelde 5c43e4c1ef
Fix various typos with codespell
Using 2.2.6.dev180+ge3a2cfbd.
2023-09-12 08:54:18 +02:00
Rémi Verschelde 0545ed5c71
Merge pull request #81355 from ryanabx/features/enforce-static-typing
Add an optional `untyped_declaration` warning
2023-09-12 08:49:57 +02:00
Rémi Verschelde b539bfb263
Merge pull request #81201 from anvilfolk/rpc
GDScript: Fix subclass methods not inheriting RPC info
2023-09-12 08:49:33 +02:00
Danil Alexeev 4b5daf06ef
Editor: Improve signal callback generation 2023-09-11 18:45:39 +03:00
Danil Alexeev 2964c7d51c
GDScript: Add raw string literals (r-strings) 2023-09-11 18:34:33 +03:00
ocean (they/them) 711ffabcfe GDScript: fix subclass methods not inheriting RPC info 2023-09-11 11:10:07 -04:00
BooksBaum 0202a36a7a Language Server: Improve hovered symbol resolution, fix renaming bugs, implement reference lookup
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
Co-Authored-By: BooksBaum <15612932+booksbaum@users.noreply.github.com>
2023-09-11 09:46:34 -05:00
ryanabx 14edf044af Add "untyped_declaration" warning 2023-09-11 09:39:10 -05: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 +02:00
Aaron Franke 6f7eccc758
Add a type conversion method to Variant Utility and expose to scripting 2023-09-08 10:12:48 -05:00
Yuri Sizov d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
Danil Alexeev 242d3d81e9
GDScript: Don't make array literal typed in weak type context 2023-09-05 11:32:16 +03:00
Danil Alexeev 462d8f4752
GDScript: Fix `get_*_list()` methods return incorrect info 2023-09-04 00:21:03 +03:00
Yuri Rubinsky 35802374ac Add coloring for completion of vector components 2023-08-30 21:13:25 +03:00
Markus Sauermann c4705a590b Fix Object::notification order
Previously the `p_reversed` parameter didn't influence the order
in a correct way.
Also script overridden _notification functions were not called in
the correct order.

To fix this some `notification` functions had to add a `p_reversed`
parameter.

This made it necessary to adjust cpp-bindings.

Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-30 00:15:55 +02:00
Rémi Verschelde 76d318dbd1
Merge pull request #75778 from KoBeWi/_vp
Expose `_validate_property()` for scripting
2023-08-29 12:41:27 +02: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 +02:00
kobewi 67db4693eb Expose _validate_property() for scripting 2023-08-28 15:18:48 +02:00
Rémi Verschelde fc37fd7b98
Merge pull request #81039 from MewPurPur/fix-hex-number-highlighting-after-separator
Fix highlighting of hex numbers with separators
2023-08-28 12:10:11 +02:00
MewPurPur d3946242f4 Fix highlighting of hex numbers with separators 2023-08-28 09:52:40 +03: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 +02:00
Danil Alexeev 68a567bd13
GDScript: Allow use local constants as types 2023-08-25 17:04:04 +03:00
Danil Alexeev 89429b0273
GDScript: Fix lambda resolution with cyclic references 2023-08-25 16:29:11 +03: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 +02:00
Rémi Verschelde e43370d0fa
Merge pull request #80686 from azuloo/lsp-thread-connection-error
Fixes LSP connection error when launched in a separate thread
2023-08-21 19:26:43 +02:00
Rémi Verschelde 7d3bee73e4
Merge pull request #80247 from dalexeev/gds-for-loop-var-static-typing
GDScript: Add static typing for `for` loop variable
2023-08-21 19:26:32 +02:00
Rémi Verschelde 9becff0c54
Merge pull request #80745 from dalexeev/gds-improve-docgen
GDScript: Improve DocGen
2023-08-21 08:22:31 +02:00