Commit Graph

3334 Commits

Author SHA1 Message Date
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
Danil Alexeev 02253b6b91
GDScript: Fix continuation lines in `GDScriptTokenizerBuffer` 2024-04-10 08:51:02 +03:00
Rémi Verschelde 9a9045cf7a
Merge pull request #89382 from dcaoc03/master
Fix enum autocompletion for core classes
2024-04-09 22:25:13 +02:00
Rémi Verschelde f8ca571efe
Merge pull request #84043 from dalexeev/gds-fix-unsafe-cast-warning
GDScript: Fix `UNSAFE_CAST` warning
2024-04-09 22:24:55 +02:00
Danil Alexeev 98dac9e39c
GDScript: Fix highlighting escapes in multiline raw strings 2024-04-09 10:21:10 +03:00
kobewi 809c6817be Add tests for signal await with parameters 2024-04-08 19:12:01 +02:00
Rémi Verschelde 8f1b5d68f1
Merge pull request #90039 from AThousandShips/load_relative_note
[Doc] Document loading behavior with relative paths
2024-04-08 11:20:40 +02:00
Rémi Verschelde a2f6698098
Merge pull request #89659 from dalexeev/gds-hl-fix-types
GDScript: Fix `for` expression is highlighted as type
2024-04-08 11:20:17 +02:00
Jamie Hill-Daniel 164b34a734 Don't pass `self` when calling a static function from a non-static context 2024-04-04 21:15:17 +00:00
Danil Alexeev 27d7760f41
GDScript: Fix uninitialized local variables not being reset 2024-03-30 23:25:30 +03:00
A Thousand Ships 2508c2e309
[Doc] Document loading behavior with relative paths 2024-03-30 13:33:49 +01:00
HolonProduction d2c2194937 Completion Tests: Add script to owner 2024-03-25 16:17:44 +01:00
ppphp d4e1a74efb Add 'override' mark to ResourceFormat class 2024-03-25 04:06:34 +08:00
Rémi Verschelde 48cf825839
Merge pull request #89451 from AThousandShips/emit_fix
[Core] Disconnect one-shot signals before calling callbacks
2024-03-24 01:15:52 +01:00
Danil Alexeev 0498305b6b
GDScript: Improve DocGen for non-constant expressions 2024-03-21 12:23:54 +03:00
A Thousand Ships db455e5bee
[Core] Disconnect one-shot signals before calling callbacks
This prevents infinite recursion with one-shot connections emitting
themselves
2024-03-20 20:24:44 +01:00
VolTer de8b6f7a3c Add editor settings for autocompletion with NodePath and StringName 2024-03-19 17:23:54 +02:00
Danil Alexeev d1e2afaae3
GDScript: Do not produce `UNUSED_SIGNAL` warning for common implicit uses 2024-03-19 17:43:10 +03:00
Danil Alexeev c45242578a
GDScript: Fix `for` expression is highlighted as type 2024-03-18 22:33:08 +03:00
Diogo Costa 935ea10f3a Fixed enum autocompletion for core classes (Issue #88858)
Minor fix consisted in the use of [[fallthrough]] macro
2024-03-15 20:20:36 +00:00
Rémi Verschelde 3e773b9167
Merge pull request #89484 from dalexeev/update-gds-doc
Update `@GDScript` documentation
2024-03-14 22:35:37 +01: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 +01:00
Danil Alexeev 0c48845247
Update `@GDScript` documentation 2024-03-14 17:51:41 +03:00
Rémi Verschelde a1c476f9d7
Merge pull request #87680 from AThousandShips/the_angry_count
Add methods to get argument count of methods
2024-03-13 22:16:43 +01:00
Danil Alexeev ef1909fca3
GDScript: Fix `@warning_ignore` annotation issues 2024-03-12 19:00:06 +03:00
A Thousand Ships 59bcc2888c
Add methods to get argument count of methods
Added to:
* `Callable`s
* `Object`s
* `ClassDB`
* `Script(Instance)`s
2024-03-10 11:02:43 +01:00
Rémi Verschelde 877cd12da8
Merge pull request #89284 from mihe/lsp-multiple-messages
Allow LSP to process multiple messages per poll
2024-03-09 00:52:29 +01:00
Danil Alexeev 87718d2a6e
Editor Help: Add syntax highlighting for code blocks 2024-03-09 00:02:31 +03:00
Mikael Hermansson e2485044a1 Allow LSP to process multiple messages per poll 2024-03-08 18:49:29 +01:00
ACB 7426b4d448 Fix user after free in `GDScriptLanguage::debug_get_globals` 2024-03-08 07:32:31 +01:00
Thaddeus Crews 9903e6779b
Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 -06: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 -03:00
Rémi Verschelde 0acc4276b6
Merge pull request #82952 from AbelToy/gds-export-array
Allow `@export`ed Arrays to set property hints for their elements
2024-03-06 09:49:53 +01:00
Abel Toy 882441a0ad
Support Array and PackedArray in @export_* 2024-03-06 16:17:54 +09:00
A Thousand Ships 1e61e42250
[GDScript] Fix some test file paths 2024-03-04 19:11:28 +01:00
Rémi Verschelde 7be96a55c4
Merge pull request #86973 from HolonProduction/tests-batch-1
Add tests for `get_node` autocompletion
2024-03-04 13:32:55 +01:00
Rémi Verschelde b392ab5ff4
Merge pull request #85918 from 20kdc/tnj-static-called-on-instance-fix-confusion
GDScript: Adjust `STATIC_CALLED_ON_INSTANCE` warning to not force native type
2024-03-04 13:32:47 +01:00
HolonProduction 1621e725fa Fix autocompletion after DOLLAR token 2024-03-02 18:56:02 +01:00
Thaddeus Crews 0ce9b6fd1d
Add two new COMSTR environment variables 2024-03-01 12:44:03 -06:00
20kdc 24181d1055
GDScript: Adjust STATIC_CALLED_ON_INSTANCE warning to not default to the native type, and to not trigger on self-calls
Not defaulting to the native type rationale:

Defaulting to the native type is less than useful, as:

* There are very few native types that are extensible and have static methods.
* Defaulting to the native type does not account for a method being script-defined.

While the "real fix" would be to carefully track the source of the method, the get_function_signature method is already complicated enough.

This will at least ensure the resulting code should always be valid.

Not triggering on self-calls rationale:

Found in PR comment https://github.com/godotengine/godot/pull/85918#issuecomment-1935864459

```
static func example():
	pass

func example2():
	example() # self-call on static function
```

Disabling this warning on self-calls is:

* Consistent with other languages
* Important for anonymous classes (where the output code is unusable)
2024-03-01 17:14:59 +03:00
Micky 7b3e1a5bde Optimize SceneTree's `change_scene_to_file` autocompletion 2024-03-01 15:12:52 +01:00
HolonProduction a2e7c64dc4 Cleanup 2024-03-01 13:06:37 +01:00
HolonProduction 1f42455e0a Debugging additions 2024-03-01 11:38:49 +01:00
HolonProduction fc7d7d3dae Add test for `get_node` autocompletion 2024-03-01 11:24:06 +01:00
Danil Alexeev 0908ad4005
GDScript: Fix paths in `ResourceFormatLoaderGDScript::load()` 2024-02-29 16:04:31 +03:00
Rémi Verschelde 9278856ff7
Merge pull request #88948 from dalexeev/core-add-callable-create
Core: Add `Callable.create` static method for `Variant` callables
2024-02-29 13:54:22 +01:00
Rémi Verschelde 172b254687
Merge pull request #88664 from RandomShaper/res_load_modes
Enhance cache modes in resource loading
2024-02-29 13:54:07 +01:00
Danil Alexeev d90c9db27f
Core: Add `Callable.create` static method for `Variant` callables 2024-02-29 10:45:00 +03: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 +01:00
Danil Alexeev a10241bfe4
GDScript: Fix type highlighting after whitespace 2024-02-26 20:49:05 +03:00
Pedro J. Estébanez 5e144022e7 Enhance cache modes in resource loading
- Unify documentation, hoping to clear misconcepctions about about propagation of the cache mode across dependant loads.
- Clarify in docs that `CACHE_MODE_REPLACE` now also works on the main resource (from #87008).
- Add two recursive modes, counterparts of `CACHE_MODE_REPLACE` and `CACHE_MODE_IGNORE`, since it seems some need them (see #59669, #82830).
- Let resources, even loaded with one of the ignore-cache modes, get a path, which is useful for tools.
2024-02-26 14:59:04 +01:00
Danil Alexeev 8ffc50ee8c
GDScript: Canonicalize script path in FQCN 2024-02-26 10:46:24 +03:00
Rémi Verschelde 83b32f990e
Merge pull request #88733 from ryevdokimov/Remove-word-duplicates
Remove word duplicates in comments and strings, and fix casing and punctuation
2024-02-25 11:50:09 +01:00
Rémi Verschelde ee5ace10b7
Merge pull request #85501 from /remove-packed-scene-cache 2024-02-25 11:49:27 +01:00
Robert Yevdokimov 13e82094ee Remove word duplicates in comments and strings, and fix casing and punctuation 2024-02-23 17:28:28 -05:00
Rémi Verschelde 77666286b7
Merge pull request #88020 from emre0altan/match-null-crashes-GDScript-compiler
GDScript: Set `has_type` false if it is `BUILTIN` but `Variant::NIL`
2024-02-23 22:18:55 +01:00
Rémi Verschelde 8a9c9ef94f
Merge pull request #88452 from AThousandShips/template_test
Fix running tests in template builds
2024-02-22 23:34:30 +01:00
A Thousand Ships d7a72d72e6
Fix running tests in template builds 2024-02-22 18:05:42 +01:00
Hugo Locurcio f781571d07
Add keywords to improve search in the class reference 2024-02-22 16:16:49 +01:00
Rémi Verschelde 6037500219
Merge pull request #69032 from KoBeWi/check_every_changed_setting_in_every_group_everywhere()
Use `check_changed_settings_in_group()` everywhere
2024-02-20 19:34:30 +01:00
Rémi Verschelde b652a81da7
Merge pull request #82554 from dsnopek/gdextension-placeholders
Allow registering "runtime classes" from GDExtension
2024-02-20 17:13:24 +01:00
David Snopek ea75307a11 Allow registering "runtime classes" 2024-02-20 09:20:58 -06:00
kobewi a031911c82 Use check_changed_settings_in_group() everywhere 2024-02-19 21:34:45 +01:00
Hugo Locurcio 6ae54fd787
Move EditorNode setting registration so they are in class reference
Co-authored-by: Micky <micheledevita2@gmail.com>
2024-02-17 11:33:22 +01:00
Rémi Verschelde 6f805dee2a
Merge pull request #88365 from dalexeev/gds-fix-gdc-export
GDScript: Fix extension comparison for exported scripts
2024-02-15 17:35:58 +01:00
Danil Alexeev a2e3e31e80
GDScript: Fix extension comparison for exported scripts 2024-02-15 17:53:24 +03:00
Rémi Verschelde ef5d6ccfb7
Merge pull request #86966 from Muller-Castro/value2ref-core
Add const lvalue ref to `core/*` container parameters
2024-02-15 15:44:43 +01:00
Danil Alexeev af28f87791
Documentation: Add support for deprecated/experimental messages 2024-02-15 15:59:50 +03:00
Muller-Castro a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
Rémi Verschelde c8b3e39161
Merge pull request #88211 from bitwise-aiden/ba-default-arg-hints
Add fallback argument hints for default values
2024-02-12 13:35:07 +01:00
Rémi Verschelde 986c8af29d
Merge pull request #81629 from rune-scape/more-gdscript-deps
GDScript: Include lambda dependencies
2024-02-12 13:33:22 +01:00
Aiden Storey 7ffc246aad Add fallback argument hints for default values 2024-02-11 10:01:03 -05:00
emre0altan 081fa324fd set has_type false if it is BUILTIN but Variant::NIL 2024-02-11 13:47:12 +00:00
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