Commit graph

3126 commits

Author SHA1 Message Date
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
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
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
A Thousand Ships
2508c2e309
[Doc] Document loading behavior with relative paths 2024-03-30 13:33:49 +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
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
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
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
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