Commit graph

1545 commits

Author SHA1 Message Date
Yuri Roubinsky
4c65dc975c Shows ColorRect in Color constants autocompletion 2020-10-23 19:03:50 +03:00
Rémi Verschelde
ef62e93677
Merge pull request #42943 from vnen/gdscript-local-scope-fix
Fix handling of scope for local GDScript variables
2020-10-20 21:00:57 +02:00
George Marques
96884ef41e
Merge pull request #41983 from ThakeeNathees/array-const-folding-bug-fix
Array/Dictionary Nodes no more reduced to array/dictionary variant
2020-10-20 15:43:07 -03:00
George Marques
11c05642fe
GDScript: Fix handling of scope for local variables 2020-10-20 14:57:31 -03:00
George Marques
48b91b900d
GDScript: Add initialization for the language before debug tests
This ensures that the tests will use a full environment with correct
settings so global classes and autoloads can be properly found.
2020-10-20 10:07:03 -03:00
George Marques
5ddfc657ab
Merge pull request #42067 from ThakeeNathees/for-loop-stack-overriden-fix
GDScript: for loop override stack variable bug fix
2020-10-19 20:21:14 -03:00
Umang Kalra
c37f633216 Fixes the misleading error message for call_recursive method for TreeItems 2020-10-17 12:30:36 +05:30
Hugo Locurcio
802c1e4df1
Link the Random number generation tutorial in the class reference 2020-10-14 18:03:29 +02:00
George Marques
fe6109101f
Merge pull request #41881 from ThakeeNathees/crash-on-builtin-constructor
GDScript crash on builtin type constructor fix
2020-10-08 19:35:35 -03:00
Rémi Verschelde
3556bc48a1
Merge pull request #42439 from Xrayez/doc-gdscript-load-and-resloader-xref
Cross-reference GDScript `load` and `ResourceLoader.load` in classref
2020-10-04 20:48:07 +02:00
Paulb23
ee4a1c99a7 Switch from recursion to iterative for backfilling colour regions 2020-10-03 14:58:55 +01:00
Serhat
9f2cdfea82 Fixed padding bug of sprintf function 2020-10-02 00:25:42 +03:00
Rémi Verschelde
39ea52f36f
Merge pull request #41829 from RandomShaper/fix_40353
Avoid warning about harmless unfulfilled yields
2020-10-01 14:17:34 +02:00
Andrii Doroshenko (Xrayez)
a8404cf56c Cross-reference GDScript load and ResourceLoader.load in classref
The GDScript `load` mention is moved from the class `ResourceLoader`
description to the `ResourceLoader.load` method description instead,
where it is more likely to be found.
2020-09-30 23:03:36 +03:00
Pedro J. Estébanez
de4e54dd91 Avoid infinite loop in GDScript at shutdown 2020-09-26 19:21:09 +02:00
Hugo Locurcio
50f3a8e312
Improve documentation related to printing error/warning messages 2020-09-24 14:23:53 +02:00
strank
409af31b55 Add a "not in" operator to GDScript. 2020-09-21 17:53:54 -04:00
Rémi Verschelde
cff43e5326
Merge pull request #41930 from RandomShaper/fix_gdscript_leaks
Fix leaks in GDScript
2020-09-18 16:18:57 +02:00
Rémi Verschelde
3e78963bb9
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 13:44:25 +02:00
Thakee Nathees
119936d939 GDScript: for loop override stack variable bug fix
Fix: #42050
2020-09-18 01:22:22 +05:30
Danil Alexeev
a4c5790350 Several documentation improvements 2020-09-14 20:02:19 +03:00
Thakee Nathees
e4d5393ecf GDScript export array/dictionary type infer bug fix
Fix : #41980
2020-09-13 19:36:20 +05:30
Thakee Nathees
3886a2f9f6 Array/Dictinoary no more reduced to array/dictionary variant
Fix: #41377
Fix: #20436
Fix: #41953
2020-09-11 19:46:20 +05:30
Pedro J. Estébanez
e25f5e791e Ensure cyclic dependencies between scripts are broken at exit 2020-09-10 01:34:42 +02:00
Pedro J. Estébanez
95828161d4 Prevent cyclic reference between script and its members 2020-09-10 01:26:07 +02:00
Rémi Verschelde
1c881c973b
GDScript: Fix MutexLock usage, fixes Clang 6 compat
Fixes #41852.
2020-09-09 14:56:57 +02:00
Rémi Verschelde
2410016638
Merge pull request #41709 from ThakeeNathees/dictionary-indexing-bug-fix
Fixed parser error when indexing a dictionary.
2020-09-08 21:38:14 +02:00
Thakee Nathees
279a11bbda GDScript crash on builtin type constructor fix
Fix: #41848
2020-09-08 18:33:53 +05:30
Rémi Verschelde
3c42d5789f
Merge pull request #38308 from bruvzg/sad_security_circus
Adds PCK encryption support (using script encryption key for export).
2020-09-07 17:12:01 +02:00
Pedro J. Estébanez
f76a13dea0 Avoid warning about harmless unfulfilled yields 2020-09-06 22:30:46 +02:00
Rémi Verschelde
859322343c
Merge pull request #41803 from ThakeeNathees/parameter-type-infer-bug-fix
GDScript: parameter infer type bug fix
2020-09-06 15:22:44 +02:00
Thakee Nathees
89489a3cac GDScript: parameter infer type bug fix
Fix: #41772
2020-09-06 13:26:52 +05:30
bruvzg
f043eabdd8
Adds PCK encryption support (using script encryption key for export).
Change default encryption mode from ECB to CFB.
2020-09-05 14:53:39 +03:00
Rémi Verschelde
605d7b7e82
Merge pull request #41760 from ThakeeNathees/null-dereference-on-gdscript-function-fix
null pointer dereference at GDScriptFunction::call crash fix
2020-09-04 14:45:31 +02:00
Thakee Nathees
75d4511cb5 null pointer dereference at GDScriptFunction::call fix 2020-09-04 15:24:09 +05:30
bruvzg
80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Thakee Nathees
4fc14e8e11 fixed parser error when indexing a dictionary.
Fix: #41707
2020-09-03 18:04:54 +05:30
Rémi Verschelde
d84954a281
Merge pull request #41459 from Paulb23/nested_color_regions
Fix colour region end key seach and start key order
2020-09-03 11:32:04 +02:00
bruvzg
d73609c774
Fix GDScript codegen leak. 2020-09-02 22:42:49 +03:00
Andrii Doroshenko (Xrayez)
0cc05c5a31 Register GDScript test tools as test commands to run via command-line 2020-09-02 01:43:26 +03:00
Lunatoid
07053d0c6a Fixed ParseError when calling Object.new()
Fixes #41462 where calling Object.new() in GDScript gave an error.
I fixed it by adding exclusion when checking if the name is a builtin
type to exclude objects with a comment detailing why.
2020-09-02 00:11:58 +02:00
Andrii Doroshenko (Xrayez)
6b7e50ab34 Move GDScript tests to respective folder under modules 2020-09-02 01:09:32 +03:00
George Marques
635c6a0a18
Add GDScript disassembler 2020-09-01 14:36:30 -03:00
George Marques
745ca3059d
Change GDScript compiler to use codegen abstraction 2020-09-01 14:36:22 -03:00
George Marques
82273ebc01
Add GDScript code generation interface
Implement the abstraction by targeting the current VM.
2020-09-01 14:27:19 -03:00
George Marques
a889084864
GDScript: Don't mark function parameters as constant
They can be reassigned as if it were a local variable.
2020-09-01 09:26:28 -03:00
George Marques
c8e10aa20b
GDScript: Properly set class inheritance for global classes 2020-09-01 09:26:28 -03:00
George Marques
164cc8705b
GDScript: Check for missing exponent when parsing numbers
Also forbid multiple underscores in a row as numeric separator.
2020-09-01 09:26:28 -03:00
George Marques
f8fa5e4738
GDScript: Fix analysis of singleton dependencies
Sometimes a singleton might depend on another before they are fully
compiled so we can't rely on globals in this case.
2020-09-01 09:26:28 -03:00
George Marques
edb4caf24e
GDScript: Allow "extends" to be used inside inner class 2020-09-01 09:26:27 -03:00
George Marques
34dc689ad4
GDScript: Allow "self" to be used in class level 2020-09-01 09:26:27 -03:00
George Marques
1ddb9b1a52
GDScript: Don't try to parse constant scripts that aren't valid
Since it's likely that they won't parse correctly.
2020-09-01 09:26:27 -03:00
Hugo Locurcio
c4903a603b
Add link titles for all links in the class reference
This makes them display in a nicer way in the editor help.
(The title will display instead of the full URL.)
2020-08-31 14:22:07 +02:00
Hugo Locurcio
20d0f5bbd7
Cross-reference GDScript built-in rounding methods to ease discovery
This closes #19315.
2020-08-28 17:04:22 +02:00
Rémi Verschelde
46809332dd
Merge pull request #41547 from vnen/gdscript-2-fixes
Some more GDScript fixes
2020-08-28 10:36:09 +02:00
George Marques
5033d5c71c
GDScript: Fix crash when parsing properties 2020-08-26 16:08:19 -03:00
George Marques
b2b45987d0
GDScript: Show error when there's an inheritance cycle 2020-08-26 16:01:08 -03:00
George Marques
4a3fca47e5
GDScript: Add recursion depth limit for completion
To avoid crashes when there's a dependency loop.
2020-08-26 15:38:23 -03:00
George Marques
ff16ba1eaa
GDScript: Fix crash when completing code with signals 2020-08-26 15:13:42 -03:00
George Marques
8ccf88a206
GDScript: Fix issues when deriving from other scripts 2020-08-26 14:50:27 -03:00
Rémi Verschelde
9d8f3496e8
Merge pull request #40443 from SkyLucilfer/PluralsSupport
Added plurals and context support to Translation
2020-08-25 12:11:56 +02:00
George Marques
722be9aaef
GDScript: Don't fail to load constants if they're not a literal
It's still okay as long as it's a constant value. This should already
been validated by the analyzer.
2020-08-24 09:15:33 -03:00
George Marques
ca90c9c9a9
GDScript: Properly resolve external inner classes from preload
This gets the correct parser and class node when resolving from a full
GDScript reference.
2020-08-23 12:55:27 -03:00
George Marques
d36d7e2a1c
GDScript: Use pointer instead of references in cache
They are not supposed to be kept alive and this is cleaner and less
error-prone than unreferencing the elements.
2020-08-23 12:55:27 -03:00
George Marques
58f5c2bab6
Merge pull request #41238 from MarianoGnu/gdscript-export-resource
Fix GdScript Analyzier not detecting Resource subclass correctly
2020-08-23 11:04:52 -03:00
Paulb23
6cdcdbc242 Fix color region end key seach and start key order 2020-08-22 19:55:44 +01:00
George Marques
a880f590e4
GDScript: Make subscript access be properly type checked 2020-08-19 14:35:26 -03:00
George Marques
846856728b
GDScript: Show error when function return type is missing 2020-08-19 14:09:45 -03:00
George Marques
15b16ec0ce
GDScript: Fix signal parameters not respecting commas 2020-08-19 11:32:48 -03:00
George Marques
cd3f51c67c
GDScript: Check duplicate keys in dictionaries and enums 2020-08-19 11:14:16 -03:00
George Marques
f9ad0b30fa
GDScript: Allow preload() to be used with constant expressions 2020-08-19 10:45:00 -03:00
George Marques
a52e457ada
GDScript: Allow keywords to be used in $ notation 2020-08-19 10:19:05 -03:00
SkyJJ
ce3461dc88 Update GDScriptTranslationParserPlugin to use GDSriptParser instead of RegEx. 2020-08-19 03:10:51 +02:00
SkyJJ
396f2eee82 Update POT generation to handle context and plurals 2020-08-19 03:01:52 +02:00
George Marques
35176247af
GDScript: Allow enum values to be set to constant expressions
Also allow them to access previous values wihout referencing the enum.
2020-08-18 17:44:20 -03:00
George Marques
99d4ea8c79
GDScript: Allow supertype objects to be assigned to a subtype variable
It allows `get_node()` to be used with typed variables

This is marked as unsafe to warn the user.
2020-08-18 15:12:51 -03:00
George Marques
8bc9b3a2ae
GDScript: Allow implicit type conversion when constructing variants
Incidentally fix error message when no valid constructor is found which
was missing an end parenthesis.
2020-08-18 13:12:18 -03:00
George Marques
8088e9e6ac
GDScript: Add script to cache on reload
This ensures that scripts created without a resource loader are properly
included in the cache (such as builtin scripts) and are not tried to be
loaded from the disk.
2020-08-18 11:21:09 -03:00
George Marques
0f9923e67f
GDScript: Allow empty files to be valid scripts 2020-08-17 21:32:49 -03:00
George Marques
3abb3c0d6e
GDScript: Fix crash when superclass file is non-existent
Incidentally, allow EOF to be an end of statement.
2020-08-17 21:30:39 -03:00
George Marques
fda6f3b600
GDScript: Fix LSP getting wrong union value on unnamed enums 2020-08-17 21:10:30 -03:00
George Marques
d06ce2f11e
GDScript: Fix editor crash when writing @tool annotation 2020-08-17 21:02:49 -03:00
George Marques
f374021d52
GDSript: Prevent crash when completing unary operators 2020-08-17 20:49:04 -03:00
George Marques
9ecd042e78
GDScript: Allow "match" to be used as an identifier
This is needed to call the String.match() function.
2020-08-17 20:14:46 -03:00
George Marques
d45e1befe3
GDScript: Fix wrong argument check for formatting operator 2020-08-17 19:49:54 -03:00
Mariano Suligoy
a8c01df647 Fix GdScript Analyzier not detecting Resource subclass correctly 2020-08-13 19:46:57 -03:00
George Marques
adc1f95d97
Merge pull request #41224 from ThakeeNathees/fix-ctrl+click-not-working
Fix: ctrl + click not working on script member
2020-08-13 10:25:46 -03:00
Thakee Nathees
c6dc73f9be Fix: ctrl + click not working 2020-08-13 17:35:17 +05:30
George Marques
9413446b2d
Merge pull request #41104 from vnen/gdscript-assignment-tidy
Tidy up assignment operator check
2020-08-12 08:54:48 -03:00
Rémi Verschelde
cf05486d8e
Merge pull request #41055 from snichols/null-callee-fix
Fix crash with null callee
2020-08-11 15:15:43 +02:00
Paulb23
5cf2cf8646 Fix colour region continuation over blank lines, issue 41120 2020-08-08 15:36:46 +01:00
George Marques
69c81309cc
Merge pull request #40673 from ThakeeNathees/gdscript-op-eval-validation
GDScript operator evaluation validation bug fix
2020-08-08 10:52:40 -03:00
George Marques
1f14068727
Merge pull request #40951 from bruvzg/gds_cleanup
[GDScript] Add static HashMap cleanup.
2020-08-08 10:44:57 -03:00
George Marques
3aef60591b
GDScript: Tidy up assignment operator check
The operator is already gathered by the parser, no need to do it again
in the analyzer.
2020-08-08 10:37:51 -03:00
Thakee Nathees
38c7d080e8 GDScript: unsafe arithmetic assignment bug fix
Fix: #41051
2020-08-06 11:12:26 +05:30
Stephen Nichols
fbd07bf3bf Adding error message for empty grouping expression 2020-08-05 14:42:33 -05:00
Stephen Nichols
8a13be50ab Fixing null callee crash. 2020-08-05 14:41:46 -05:00
George Marques
9adf6d3441
Merge pull request #40690 from ThakeeNathees/arithmetic-assign-type-check-bug-fix
GDScript arithmetic assignment type check bug fix
2020-08-03 09:26:09 -03:00
unknown
561af0c17d Fixed tiny grammar issues in error messages 2020-08-03 14:03:28 +05:30
bruvzg
ee973f5b90
[GDScript] Add static HashMap cleanup. 2020-08-01 22:08:12 +03:00
Rémi Verschelde
ba853f86af
Merge pull request #40903 from Calinou/doc-json
Improve JSON-related documentation
2020-07-31 10:39:56 +02:00
Hugo Locurcio
930e10ffff Improve JSON-related documentation
This closes https://github.com/godotengine/godot-docs/issues/3848.
2020-07-31 09:56:11 +02:00
Rémi Verschelde
9833f9cc11 doc: Fix typo in BBcode tag 2020-07-30 16:24:37 +02:00
SkyJJ
9cd1ef573c Refix GDScriptTranslationParser leak 2020-07-29 23:17:58 +02:00
Lyuma
68566b7bec GDScript: Fix crash caused by inconsistent get_member 2020-07-29 02:56:03 -07:00
Rémi Verschelde
a6916d1f17
Merge pull request #40678 from aaronfranke/string-float64
Make all String float conversion methods be 64-bit
2020-07-28 01:27:34 +02:00
Rémi Verschelde
932b75e247 doc: Sync classref with current source 2020-07-28 01:08:44 +02:00
Aaron Franke
56e2c6c704
Make all String float conversion methods be 64-bit 2020-07-27 18:38:53 -04:00
Rémi Verschelde
4e825539e5
Merge pull request #40762 from SkyLucilfer/PackedSceneLeak
Fix EditorTranslationParser leak
2020-07-28 00:31:46 +02:00
George Marques
04f46aea8d
GDScript: Fix crash on 'await' completion 2020-07-27 17:17:39 -03:00
SkyJJ
0e54ba0486 Fix EditorTranslationParser leak 2020-07-27 17:02:53 +02:00
Rémi Verschelde
3e99059129
Merge pull request #40714 from ThakeeNathees/Object-type-bug-fix
GDScript: "Object" datatype changed from BUILTIN to NATIVE
2020-07-27 08:50:16 +02:00
Rémi Verschelde
33d423e240
Merge pull request #39898 from Meriipu/master_gdscript
GDScript: Clarified/fixed inaccuracies in the built-in function docs.
2020-07-26 17:12:13 +02:00
Rémi Verschelde
b2096ba53e
Merge pull request #40670 from vnen/remove-multilevel-call
Remove multilevel calls
2020-07-26 17:09:41 +02:00
Thakee Nathees
194c2aa7e2 GDScript: "Object" datatype changed from BUILTIN to NATIVE
Fix: #40656
2020-07-26 08:00:55 +05:30
Thakee Nathees
5ba46ddf8e GDScript arithmetic assignment type check bug fixed
Fix: #40686
2020-07-26 06:46:13 +05:30
Meriipu
7f9bfee0ac GDScript: Clarified/fixed inaccuracies in the built-in function docs.
The input to smoothstep is not actually a weight, and the decscription
of smoothstep was pretty hard to understand and easy to misinterpret.

Clarified what it means to be approximately equal.

nearest_po2 does not do what the descriptions says it does. For one,
it returns the same power if the input is a power of 2. Second, it
returns 0 if the input is negative or 0, while the smallest possible
integral power of 2 actually is 1 (2^0 = 1). Due to the implementation
and how it is used in a lot of places, it does not seem wise to change
such a core function however, and I decided it is better to alter the
description of the built-in.

Added a few examples/clarifications/edge-cases.
2020-07-25 20:26:02 +02:00
Thakee Nathees
04dfb78d23 GDScript operator evaluation validation bug fix
Fix: #40665
2020-07-24 23:32:29 +05:30
George Marques
2b9d9bc364
Remove multilevel calls
In general they are more confusing to users because they expect
inheritance to fully override parent methods. This behavior can be
enabled by script writers using a simple super() call.
2020-07-24 14:13:58 -03:00
George Marques
e6b44b93c3
GDScript: Allow "new()" to be called in non-static functions 2020-07-24 13:45:23 -03:00
Rémi Verschelde
3811fb919e
Merge pull request #40598 from vnen/gdscript-2.0
GDScript 2.0 (again)
2020-07-24 01:04:57 +02:00
George Marques
a0f54cb95e
Wrap up GDScript 2.0 base implementation 2020-07-22 11:07:51 -03:00
Aaron Franke
83e324d670
Update core documentation to match recent C# changes
Also a few minor API changes like adding AABB.abs()

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-07-21 14:44:53 -04:00
George Marques
aa09b4f85d
Reintroduce code completion 2020-07-20 11:38:40 -03:00
George Marques
b6a2628c48
Reenable GDScript LSP server 2020-07-20 11:38:40 -03:00
George Marques
dadfcd8aba
Added support for enums to be used as types in GDScript 2020-07-20 11:38:40 -03:00
George Marques
95c0909290
Add warning checks in GDScript analyzer
Reenable checking those when validating code.
2020-07-20 11:38:40 -03:00
George Marques
9a76ab8b6a
Add new GDScript type checker 2020-07-20 11:38:40 -03:00
George Marques
17cd6347ba
Add better local variable detection in GDScript parser
Also store Variant operator to avoid needing to do it repeatedly in
later compiling stages.
2020-07-20 11:38:39 -03:00
George Marques
7adb0d77cc
Add GDScript cache singleton 2020-07-20 11:38:39 -03:00
George Marques
886732ac2b
Add support for properties 2020-07-20 11:38:39 -03:00
George Marques
34c28eb2b8
Fix comments in beginning of file
Also improve error for unknown characters.
2020-07-20 11:38:39 -03:00
George Marques
5d6e853806
New GDScript tokenizer and parser
Sometimes to fix something you have to break it first.

This get GDScript mostly working with the new tokenizer and parser but
a lot of things isn't working yet. It compiles and it's usable, and that
should be enough for now.

Don't worry: other huge commits will come after this.
2020-07-20 11:38:39 -03:00
Ryan Roden-Corrent
8dcc39ec91
Include gdscript warning name in LSP message.
My initial attempt changed this in the gdscript code, which resulted in
a duplicate warning name in the builtin editor. We should just append
the warning name in the LSP instead.

This uses parens to match what is shown in the builtin editor.
2020-07-14 07:11:16 -04:00
Ryan Roden-Corrent
d92fa3b547
Revert "Include gdscript warning name in the warning message."
This reverts commit de3ad3b30e.
2020-07-14 06:43:58 -04:00
Paulb23
bc4cee4458 Extract Syntax highlighting from TextEdit and add EditorSyntaxHighlighter
- Extacted all syntax highlighting code from text edit
- Removed enable syntax highlighting from text edit
- Added line_edited_from signal to text_edit
- Renamed get/set_syntax_highlighting to get/set_syntax_highlighter
- Added EditorSyntaxHighligher
2020-07-11 17:09:58 +01:00
Paulb23
156daddaaf Expose Syntax highlighter for editor plugins 2020-07-11 15:40:00 +01:00
Paulb23
2f1080be9b Convert syntax highlighters into a resource 2020-07-11 15:26:58 +01:00
Taylor C. Richberger
91ce8d5fff
remove invalid codeLensProvider value from lsp
codeLensProvider was false, it may not be a boolean like some of the other providers can, only optionally present.
2020-07-11 00:57:32 -06:00
Marcel Admiraal
26fcf2b04c Add override keywords. 2020-07-10 13:56:54 +01:00
SkyJJ
e9c8bf5e1b Fix GDScriptEditorTranslationParserPlugin instance leak 2020-07-06 22:40:52 +02:00
Rémi Verschelde
a535b9160d
Merge pull request #40155 from rcorre/warning-names
Include gdscript warning name in the warning message.
2020-07-06 16:49:54 +02:00
Rémi Verschelde
80582d1f82
Merge pull request #40116 from ThakeeNathees/editor-crash-on-super-constructor
Fix: editor crash on super constructor called
2020-07-06 16:45:37 +02:00
Ryan Roden-Corrent
de3ad3b30e
Include gdscript warning name in the warning message.
Occasionally you want to ignore a warning with a `warning-ignore`
comment, and you have to go into the settings to look up what the
actual name of the warning is. This patch appends the warning name to
the end of the warning so you know what string to use to ignore it,
similar to other linters like pylint.

For example

```
"The signal 'blah' is declared but never emitted.";
```

is now

```
"The signal 'blah' is declared but never emitted. (UNUSED_SIGNAL)";
```
2020-07-06 07:22:34 -04:00
SkyJJ
cae6f0bda2 Change translation parser plugin API to parse_file() 2020-07-05 12:14:56 +02:00
Thakee Nathees
023b3f2786 Fix: editor crash on super constructor called
Fix: #39909
2020-07-04 16:06:07 +05:30
SkyJJ
efb4609425 Add translation parser plugin support 2020-07-02 14:47:35 +02:00
Rémi Verschelde
a8a2769bb6
Merge pull request #38713 from aaronfranke/string-64bit
Make all String integer conversion methods be 64-bit
2020-07-01 16:01:05 +02:00
Tomasz Chabora
13298ed873 Improve the preload and load descriptions 2020-06-28 20:51:46 +02:00
Rémi Verschelde
d341181f30
Merge pull request #38067 from ThakeeNathees/elif-error-line-fixed
GDScript debugger incorrect error line fixed
2020-06-17 19:17:44 +02:00
Thakee Nathees
9325671faa GDScript debugger incorrect error line fixed
if the first line of an else or an elif throws a runtime error the
debugger shows incorrect line number.
2020-06-17 21:24:01 +05:30
Rémi Verschelde
697897cc61
Merge pull request #39275 from ThakeeNathees/shadowed-warning-for-loop-counter
Added shadowed var warning for `for` loop counter
2020-06-16 15:51:31 +02:00
Rémi Verschelde
6cefb8d368
Merge pull request #39314 from ThakeeNathees/debugger-incorrect-line-fix
GDScript debugger stepping to incorrect line fix
2020-06-16 09:26:49 +02:00
Rémi Verschelde
df0779acfd
Merge pull request #39315 from ThakeeNathees/ctrl-click-fix-for-subclasses
Fix: Ctrl + Click not working for subclasses
2020-06-16 09:26:15 +02:00
Rémi Verschelde
786f4ada35 GDScript LSP: Fix wrong error checks added in #39385
Reverts `latest_client_id` back to 0, as I misunderstood how the client
IDs are assigned and, without further testing and debugging, I can't
say if this was a bug or a valid default value.
Similarly, a `latest_client_id` of -1 is no longer raising an error.

Fixes #39548.
2020-06-15 09:51:56 +02:00
Rémi Verschelde
e34f33711b GDScript LSP: Fix crash in notify_client
`latest_client_id` now defaults to `-1` (invalid ID) instead of `0`.

Also fix typo in notification `gdscrip_client/changeWorkspace`,
and fix argument names in method binds.

Fixes #39375.
2020-06-08 11:01:45 +02:00
Rémi Verschelde
36f6103026
Merge pull request #39301 from Calinou/fix-argument-parameter-confusion
Tweak the GDScript error message about passed argument type mismatch
2020-06-05 11:33:53 +02:00
Rémi Verschelde
150ba031de
Merge pull request #39276 from ThakeeNathees/predefined-check-for-loop-counter
Added predefined var check for `for` loop counter
2020-06-05 11:01:55 +02:00
Thakee Nathees
95b0a00d2c Fix: Ctrl + Click not working for subclasses 2020-06-05 12:25:07 +05:30
Thakee Nathees
fc89c5c76d Debugger stepping to incorrect line fix
Fix: #39296
2020-06-05 12:15:37 +05:30
Hugo Locurcio
30053de182
Tweak the GDScript error message about passed argument type mismatch
This makes it less confusing.

This closes https://github.com/godotengine/godot-proposals/issues/670.
2020-06-04 22:31:37 +02:00
Thakee Nathees
e153772de2 predefined var check for for loop counter 2020-06-04 10:37:22 +05:30
Thakee Nathees
54835a5302 shodowed var warning for for loop counter
Fix: #39268
2020-06-04 10:28:09 +05:30
Aaron Franke
25c978730b
Rename String bin_to_int64 to bin_to_int
And also change String static to_int(const char *) to return int64_t
2020-06-03 00:04:15 -04:00
Aaron Franke
e5ae89775a
Remove 32-bit String hex_to_int method 2020-06-03 00:03:34 -04:00
Aaron Franke
bb8aa107fd
Remove 32-bit String to_int method 2020-06-03 00:03:34 -04:00
George Marques
0f1da72492
Actually set GDScript static reference 2020-05-29 11:01:48 -03:00
Rémi Verschelde
ab460e7a6f
Merge pull request #39074 from vnen/gdscript-assert-message
Fix assert message when no custom message is set
2020-05-27 08:23:17 +02:00
George Marques
f29a2e2606
GDScript: Fix assert message when no custom message is set 2020-05-26 20:40:59 -03:00
Rémi Verschelde
bfac9b3538
Merge pull request #39015 from ThakeeNathees/dict-key-autocomplete-regression-fix
regression: dictionary key no autocomplete fix
2020-05-25 15:58:08 +02:00
Thakee Nathees
13c372b522 regression: dictionary key no autocomplete fix
Fix: #38998
2020-05-24 16:52:44 +05:30
Rémi Verschelde
78e223569b
Merge pull request #33689 from jbuck3/signal-error
Trigger an error when trying to define a preexisting signal in GDScript
2020-05-21 11:01:23 +02:00
Rémi Verschelde
af366c7adf
Merge pull request #35900 from yamgent/unreachable
Fix false positive "Unreachable code" warning for loops
2020-05-21 10:59:59 +02:00
Pedro J. Estébanez
1f0548efd4 Fix too eager GDScriptFunctionState stack cleanup 2020-05-19 16:41:14 +02:00
Tan Wang Leng
7b1423a61e gdscript_parser: Fix "unreachable code" false positive for loops
Depending on the conditional statements of the 'for' and 'while' loops,
their body may not even execute once. For example:

    func a():
        var arr = []
        for i in arr:
            return i
        # can be reached, but analysis says cannot
        return -1

    func b():
        var should_loop = false
        while should_loop:
           return 1
        # can be reached, but analysis says cannot
        return 0

The parser will complain that the statements after the comment cannot
be reached, but it is clearly possible for our scenario. This is
because the parser falsely assumes that the loop body will always
execute at least once.

Fix the code to remove this assumption for both of those loops.
2020-05-16 20:02:55 +08:00
Oliver Frank
6815bf42b3 Fix incorrect capabilities notification in LSP
(cherry picked from commit 2173d041af)
2020-05-15 23:55:49 +02:00
Thakee Nathees
c076a2b7e9 break, continue outside of a loop, match statement handled 2020-05-15 03:16:50 +05:30
Rémi Verschelde
00949f0c5f
Merge pull request #38738 from akien-mga/cause-we-never-go-out-of-style
Style: Remove new line at block start, enforce line between functions, enforce braces in if and loop blocks
2020-05-14 23:09:03 +02:00
Rémi Verschelde
0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde
5046f666a1
Merge pull request #38610 from ThakeeNathees/infer-type-null-error
set parser error when infer type is null
2020-05-14 21:50:48 +02:00
Rémi Verschelde
07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
963a27f8a2
Merge pull request #38611 from ThakeeNathees/shadow-var-warning-bug-fix
shadowed var warning in nested block bug fix
2020-05-14 16:48:56 +02:00
Rémi Verschelde
1a8167867b Modernize remaining uses of 0/NULL instead of nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde
1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
Thakee Nathees
687b1941b4 set parser error when infer type is null 2020-05-13 22:12:23 +05:30
Rémi Verschelde
e7c9d81876
Merge pull request #38609 from ThakeeNathees/range-crash-with-non-numeric-const-fix
range() with non-numeric const argument crash fix
2020-05-13 15:42:29 +02:00
Rémi Verschelde
dc649684be
Merge pull request #38708 from ThakeeNathees/init-assign-type-parser-bug-fix
regression: var declaration type info parser bug fix
2020-05-13 15:41:28 +02:00
Thakee Nathees
e7f056dfac regression: static func can't access const fix 2020-05-13 06:07:22 +05:30
Thakee Nathees
e5d735851d regression: var declaration type info parser bug fix 2020-05-13 05:58:27 +05:30
Rémi Verschelde
69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Rémi Verschelde
e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Rémi Verschelde
da898c116c
Merge pull request #37160 from ThakeeNathees/saveing-cyclic-inheritance-crash-fix
Fix: saving gdscript with cyclic inheritance crash the editor
2020-05-10 13:11:40 +02:00
Rémi Verschelde
a128dd97d6
Merge pull request #37020 from aaronfranke/range
Allow using integer vectors for iteration and make range() use them
2020-05-10 13:11:07 +02:00
Thakee Nathees
79eee93b9a shadowed var warning in nested block bug fix
Fix: #38552
2020-05-10 10:54:23 +05:30
Thakee Nathees
3e10392d48 range() with non-numeric const argument crash fix 2020-05-10 10:07:23 +05:30
Thakee Nathees
c2ab35bdde fixed: saving gdscript with cyclic inheritance crash the editor
Fix: #9609
2020-05-10 09:07:09 +05:30
Thakee Nathees
5758d87f09 more clearer unexpected statement end error messages 2020-05-10 02:35:27 +05:30
Rémi Verschelde
a4b829410c
Merge pull request #38481 from RandomShaper/improve_yield
Fix object leaks caused by unfulfilled yields
2020-05-09 22:02:52 +02:00
Rémi Verschelde
b61a496aa7
Merge pull request #38357 from ThakeeNathees/dict2inst-crash-fix
fix: dict2inst crash when constructor has arguments
2020-05-09 22:00:04 +02:00
Rémi Verschelde
cf0953fefa
Merge pull request #37598 from ThakeeNathees/GDScript-type-resolve-bug-fix
GDScript class var type resolve bug fixed
2020-05-09 21:59:26 +02:00
Rémi Verschelde
f5371bc6b8
Merge pull request #37033 from ThakeeNathees/python-like-str-escape
python like string escape implemented
2020-05-09 21:53:59 +02:00
Rémi Verschelde
c04cdc2bf1
Merge pull request #38412 from ThakeeNathees/static-func-var-access
parser error for static func access non-static variables
2020-05-09 21:32:28 +02:00
Aaron Franke
cf4482e8c4
Change get_completion_identifier_is_function to return a bool
A minor bugfix
2020-05-09 13:45:00 -04:00
Aaron Franke
f7b50992b5
Allow using integer vectors for iteration and make range() use them 2020-05-09 13:43:35 -04:00
Pedro J. Estébanez
46bfe4452f Fix object leaks caused by unfulfilled yields
Now the stack saved in a `GDScriptFunctionState` is cleared as soon as the `yield()` operation is known not to be resumed because either the script, the instance or both are deleted.

This clears problems like leaked objects by eliminating cases of circular references between `GDScriptFunctionState`s preventing them and the objects they refer to in their saved stacks from being released. As an example, this makes using `SceneTreeTimer` safer.

Furthermore, with this change it's now possible to print early warnings about `yield()`s to released script/instances, as now we know they won't be successfully resumed as the condition for that happens. However, this PR doesn't add such messages, to keep the observed behavior the same for the time being.

Also, now a backup of the function name in `GDScriptFunctionState` is used, since the script may not be valid by the time the function name is needed for the resume-after-yield error messages.
2020-05-05 17:54:15 +02:00
Rémi Verschelde
4d50f747d5
Merge pull request #37293 from Janglee123/ctrl-click-improvements
Improved go-to definition (Ctrl + Click)
2020-05-05 16:49:15 +02:00
janglee
be7a353c70 Improved go-to definition (Ctrl + Click)
Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
2020-05-05 10:46:12 +05:30
Rémi Verschelde
3c200b23fb
Merge pull request #32534 from Xrayez/fix-dict2inst-init
Make `dict2inst` to work with arbitrary `_init` parameters
2020-05-03 09:58:07 +02:00
Thakee Nathees
ce978517e0 parser error for static func access non-static variables
Fix: #38408
2020-05-03 11:45:11 +05:30
Steven Schoen
e6e5ba32cd Mention offending function name in "Indented block expected" error 2020-05-02 17:10:34 -07:00
Fabio Alessandrelli
d883b90988
Merge pull request #38105 from AndreaCatania/AndreaCatania-patch-2
Removed noisy ERR check from Multiplayer API.
2020-05-01 13:53:55 +02:00
Andrii Doroshenko (Xrayez)
7001d06f9d Make dict2inst to work with arbitrary _init parameters
This is achieved by skipping initializer call while creating an instance
of a GDScript. This is implemented by passing -1 as an argument count
to `_new` and interpreting any value below 0 to mean that the initializer
should not be called during instantiation, because internal members of
an instance are going to be overridden afterwards.
2020-04-30 18:30:04 +03:00
Thakee Nathees
9f6b20936e fix: dict2inst crash when constructor has arguments 2020-04-30 17:35:53 +05:30
Rémi Verschelde
92d4a0cbd2
Merge pull request #38288 from RandomShaper/imvu/fix_not_freed_gdsfuncstate
Fix leaked objects when game ends with yields in progress
2020-04-29 17:30:28 +02:00
Rémi Verschelde
39a0cdac5f
Merge pull request #38279 from BigRed-118/assert_mark_as_safe_regression_bug
Fix for marking assert lines as safe bug
2020-04-29 16:24:38 +02:00
Pedro J. Estébanez
c427334393 Fix leaked objects when game ends with yields in progress 2020-04-29 13:55:10 +02:00
Aaron Franke
540156b387
[Core] Rename linear_interpolate to lerp 2020-04-29 04:02:49 -04:00
Tom Evans
bd081df519 Fix for marking assert lines as safe bug
Calling _reduce_node_type from GDScriptParser::_parse_block for assert
was using a current class with a scope that didn't include all
functions. Now calling in GDScriptParser::_check_block_types uses the
right class type. We also now check the assert node message. The assert
line was added to the set_errors associated with assert, since before
the error would be reported on the next line
2020-04-27 20:25:54 -05:00
Rémi Verschelde
f61587b158
Merge pull request #36927 from ThakeeNathees/export-var-type-reduce-implimented
Fix: export var type reduce() implemented
2020-04-27 17:01:04 +02:00
Thakee Nathees
cd487201c6 export var type reduce() implemented 2020-04-27 19:26:57 +05:30
Rémi Verschelde
97f04e42f6
Merge pull request #37172 from theoway/autoCompletionBug
Fixed the auto-completion bug in gdscript_editor
2020-04-24 17:27:04 +02:00
Rémi Verschelde
39f77f95b8
Merge pull request #37265 from BigRed-118/mark_assert_safe
Mark assert lines as safe in gdscript
2020-04-24 17:24:45 +02:00
Rémi Verschelde
514fb5fa8a
Merge pull request #37232 from ThakeeNathees/load()-autocomplete-imlpemented
autocomplete for load() function implemented
2020-04-24 17:24:23 +02:00
Rémi Verschelde
6aac75afc2
Merge pull request #37318 from ttencate/fix/argument_nulled_37312
Revert "Allow parameters passed to GDScript functions to be nulled"
2020-04-22 16:09:28 +02:00
Andrea Catania
4d8a3839d0
Removed noisy ERR check from Multiplayer API. 2020-04-22 08:12:58 +02:00
Rémi Verschelde
f914276951
Merge pull request #37537 from ThakeeNathees/const-parsing-datatype-bug-fix
GDScript: Fix type inference for const reference to global class
2020-04-21 23:04:46 +02:00
Rémi Verschelde
9716204555
Merge pull request #37712 from stoofin/pattern-bind-warning
Fix unassigned variable warnings for match bindings
2020-04-21 23:04:16 +02:00
Rémi Verschelde
4f03e302a7
Merge pull request #38041 from ThakeeNathees/class-name-check-enhance
GDScript class name existance check enhanced
2020-04-21 16:19:53 +02:00
Rémi Verschelde
a5a9bf6a19
Merge pull request #37955 from ThakeeNathees/lin-unsafe-base-know-index-unkonwn
Line marked unsafe when base known and index unkonwn
2020-04-21 16:19:34 +02:00
Rémi Verschelde
9cad835880
Merge pull request #37954 from ThakeeNathees/autocomplete-indexing-native-types
Autocompleting with indexing for builtin types added
2020-04-21 16:19:07 +02:00
Juan Linietsky
5d4dc2d45c Add ability to bind typed arrays to script API
Note: Only replaced 2 instances to test, Node.get_children and TileMap.get_used_cells
Note: Will do a mass replace on later PRs of whathever I can find, but probably need
a tool to grep through doc.
Warning: Mono will break, needs to be fixed (and so do TypeScript and NativeScript, need to ask respective maintainers)
2020-04-21 10:15:40 +02:00
Juan Linietsky
ae09b55a19 Exposed RenderingDevice to script API
Also added an easier way to load native GLSL shaders.

Extras:

Had to fix no-cache for subresources in resource loader, it was not properly working, making shaders not properly reload.

Note:

The precommit hooks are broken because they don't seem to support enums from one class being used in another.
Feel free to fix this after merging this PR.
2020-04-20 21:21:58 -03:00
Rémi Verschelde
2cd952bd84 Fix handling of PROPERTY_USAGE_SUBGROUP in DocData and editor
Subgroups were added in #37678 but not properly handled everywhere
where PROPERTY_USAGE_GROUP is.
2020-04-20 17:13:06 +02:00
Rémi Verschelde
0ef8bcac4d DocData: Skip unexposed classes
Properly expose classes that we actually want accessible.
2020-04-20 12:51:10 +02:00
Thakee Nathees
62280c3d47 GDScript class name existance check enhanced 2020-04-20 16:20:36 +05:30
Thakee Nathees
0780ad2800 line unsafe for indexing with known base type & unkown identifier 2020-04-17 16:52:22 +05:30
Thakee Nathees
3c45377c6e autocompleting with indexing for native types added
Fix: #37768
2020-04-17 12:13:57 +05:30
Umang Kalra
b192c7d1ac Fixed the bool _static logic 2020-04-16 21:23:17 +05:30
Rémi Verschelde
5e5103f460
Merge pull request #37861 from reduz/implement-decals
Implement decals
2020-04-14 17:13:20 +02:00
Juan Linietsky
5944eb6e7f Implement decals
Also implemented decal atlas, so projectors and other stuff can be added.
Sidenote: Had to make RID hashable, so some unrelated includes changed
in order to include it in hashfuncs.h
2020-04-14 11:13:34 -03:00
Rémi Verschelde
cfb00d4ed0
Merge pull request #37817 from ThakeeNathees/disconnect-autocomplete
autocomplete for disconnect implemented
2020-04-13 12:07:25 +02:00
Thakee Nathees
efe90fce01 autocomplete for disconnect, is_connected implemented 2020-04-13 12:35:06 +05:30
Rémi Verschelde
67f7ba2645
Merge pull request #37395 from ThakeeNathees/collon-equal-parser-bug-fix
`:=` fails on some nodes fix: #37357
2020-04-10 12:36:44 +02:00
Stoofin
44281f233d Pattern bind counts as assignment
Fixes #34697
2020-04-09 05:01:40 -07:00
Thakee Nathees
e67eb5ca36 GDScript class var type resolve bug fixed
Fix: #37545
2020-04-05 08:35:24 +05:30
Thakee Nathees
029b34da40 GDScript: Fix type inference for const reference to global class
Fixes #37529.
2020-04-03 12:43:52 +05:30
Rémi Verschelde
ea7b497065 Replace more occurrences of NULL with nullptr 2020-04-02 14:56:01 +02:00
lupoDharkael
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Thomas ten Cate
4c3c73ef9c Add missing docs for assert message in GDScript
Seems like this was overlooked in PR #31142. See also issue #17082.
2020-03-31 19:56:44 +02:00