Pedro J. Estébanez
d56112005f
Avoid infinite loop in GDScript at shutdown
...
(cherry picked from commit de4e54dd91
)
2020-09-29 13:57:55 +02:00
Hugo Locurcio
880ab559ec
Improve documentation related to printing error/warning messages
...
(cherry picked from commit 50f3a8e312
)
2020-09-29 08:54:45 +02:00
Pedro J. Estébanez
4cab6452d9
Fix GDScript leak avoidance
...
Modify usage of types so that the `Ref` created from `base_type.script_type` doesn't involve converting first to `Variant`, which will use the constructor for `Object *`, as if the argument wasn't a `Reference`, and therefore will convert back to null.
2020-09-25 01:41:31 +02:00
Rémi Verschelde
bca2633f93
Merge pull request #41931 from RandomShaper/fix_gdscript_leaks_3.2
...
Fix leaks in GDScript (3.2)
2020-09-24 08:33:04 +02:00
Rémi Verschelde
c8859f0463
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 14:09:51 +02:00
Danil Alexeev
06f3cd8bd8
Several documentation improvements
...
(cherry picked from commit a4c5790350
)
2020-09-15 19:26:40 +02:00
Pedro J. Estébanez
8e64969184
Ensure cyclic dependencies between scripts are broken at exit
2020-09-09 14:57:34 +02:00
Pedro J. Estébanez
a0969662cd
Prevent cyclic reference between script and its members
2020-09-09 13:51:53 +02:00
Pedro J. Estébanez
51844febee
Avoid warning about harmless unfulfilled yields
2020-09-06 22:26:16 +02:00
Hugo Locurcio
afef89014b
Cross-reference GDScript built-in rounding methods to ease discovery
...
This closes #19315 .
(cherry picked from commit 20d0f5bbd7
)
2020-08-31 15:29:42 +02:00
Thakee Nathees
d04d329a1f
autocompletion inside comments bug fixed
...
Fix : #41438
2020-08-23 23:01:54 +05:30
Thakee Nathees
d53f5b55ec
Auto completion enhanced for extends and class level identifier
2020-08-17 12:54:01 +05:30
Francois Belair
e3f16a83dc
Fix line num of enums reported as the line before
2020-08-08 11:52:25 -04:00
Hugo Locurcio
fc7451204e
Improve JSON-related documentation
...
This closes https://github.com/godotengine/godot-docs/issues/3848 .
(cherry picked from commit 930e10ffff
)
2020-07-31 13:09:21 +02:00
Rémi Verschelde
6d2f8dd827
doc: Sync classref with current source
2020-07-30 16:26:45 +02:00
Aaron Franke
3ab5183ffa
[3.2] Backport core documentation changes to 3.2
...
Also add AABB.abs()
2020-07-21 21:22:54 -04:00
Ryan Roden-Corrent
4677502d7c
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.
(cherry picked from commit 8dcc39ec91
)
2020-07-15 12:15:16 +02:00
Ryan Roden-Corrent
f7b994aef8
Revert "Include gdscript warning name in the warning message."
...
This reverts commit de3ad3b30e
.
(cherry picked from commit d92fa3b547
)
2020-07-15 12:15:12 +02:00
Ryan Roden-Corrent
a8d4ca0e1b
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)";
```
(cherry picked from commit de3ad3b30e
)
2020-07-06 16:51:17 +02:00
Thakee Nathees
9ce1fe59ea
Fix: editor crash on super constructor called
...
Fix : #39909
(cherry picked from commit 023b3f2786
)
2020-07-06 16:47:44 +02:00
Tomasz Chabora
5b7eb3fd3f
Improve the preload and load descriptions
...
(cherry picked from commit 13298ed873
)
2020-06-29 10:58:25 +02:00
Thakee Nathees
438f1a8238
Fix: Ctrl + Click not working for subclasses
...
(cherry picked from commit 95b0a00d2c
)
2020-06-18 11:29:28 +02:00
Thakee Nathees
fc92f83c30
Debugger stepping to incorrect line fix
...
Fix : #39296
(cherry picked from commit fc89c5c76d
)
2020-06-18 11:29:28 +02:00
Thakee Nathees
931a927a40
shodowed var warning for `for` loop counter
...
Fix : #39268
(cherry picked from commit 54835a5302
)
2020-06-18 10:51:45 +02:00
Thakee Nathees
bf9df88a7c
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.
(cherry picked from commit 9325671faa
)
2020-06-18 10:51:45 +02:00
Rémi Verschelde
1cf8652945
Merge pull request #39263 from ThakeeNathees/is-operation-fail
...
[3.2] Fix `is` operation fail on get_script()
2020-06-16 16:28:43 +02:00
Rémi Verschelde
93e20a4cd4
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 .
(cherry picked from commit 786f4ada35
)
2020-06-15 14:34:35 +02:00
Rémi Verschelde
7bf9787921
SCons: Format buildsystem files with psf/black
...
Configured for a max line length of 120 characters.
psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:
- Manually wrapped strings will be reflowed, so by using a line length
of 120 for the sake of preserving readability for our long command
calls, it also means that some manually wrapped strings are back on
the same line and should be manually merged again.
- Code generators using string concatenation extensively look awful,
since black puts each operand on a single line. We need to refactor
these generators to use more pythonic string formatting, for which
many options are available (`%`, `format` or f-strings).
- CI checks and a pre-commit hook will be added to ensure that future
buildsystem changes are well-formatted.
(cherry picked from commit cd4e46ee65
)
2020-06-10 15:30:52 +02:00
Rémi Verschelde
3edae035d5
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 .
(cherry picked from commit e34f33711b
)
2020-06-10 15:30:52 +02:00
Hugo Locurcio
aeb5513bab
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 .
(cherry picked from commit 30053de182
)
2020-06-05 12:50:55 +02:00
Thakee Nathees
837cba7567
predefined var check for `for` loop counter
...
(cherry picked from commit e153772de2
)
2020-06-05 12:45:12 +02:00
George Marques
a8332e30f0
GDScript: Fix assert message when no custom message is set
...
(cherry picked from commit f29a2e2606
)
2020-06-04 12:09:39 +02:00
Thakee Nathees
8f795cb38e
Fix `is` operation fail on get_script()
...
Fix : #39244
2020-06-03 21:04:48 +05:30
George Marques
a0983637cf
GDScript: Allow get_script() to be considered a type
2020-06-03 10:48:43 -03:00
Tan Wang Leng
48a2fd7a3d
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.
(cherry picked from commit 7b1423a61e
)
2020-05-25 16:31:07 +02:00
James Buck
9347a6ad6a
Trigger an error when trying to define a preexisting signal in GDScript
...
A class can't have multiple signals with the same name, but previously users
would not be alerted to a conflict while editing the script where it occurred.
Now a helpful error will appear in the editor during script parsing.
(cherry picked from commit 9e44739324
)
2020-05-25 16:29:20 +02:00
Thakee Nathees
d611bd970d
regression: dictionary key no autocomplete fix
...
Fix : #38998
(cherry picked from commit 13c372b522
)
2020-05-25 15:58:25 +02:00
Pedro J. Estébanez
8f90d423b9
Fix too eager GDScriptFunctionState stack cleanup
...
(cherry picked from commit 1f0548efd4
)
2020-05-20 11:40:45 +02:00
Thakee Nathees
9ee77179b5
break, continue outside of a loop, match statement handled
...
(cherry picked from commit c076a2b7e9
)
2020-05-16 00:08:37 +02:00
Oliver Frank
2173d041af
Fix incorrect capabilities notification in LSP
2020-05-15 16:43:48 -04:00
Thakee Nathees
d13f46bc41
shadowed var warning in nested block bug fix
...
Fix : #38552
(cherry picked from commit 79eee93b9a
)
2020-05-14 22:01:45 +02:00
Thakee Nathees
40c43da96f
set parser error when infer type is null
...
(cherry picked from commit 687b1941b4
)
2020-05-14 22:01:26 +02:00
Thakee Nathees
e42318e41c
regression: var declaration type info parser bug fix
...
(cherry picked from commit e5d735851d
)
2020-05-13 16:14:22 +02:00
Thakee Nathees
6d7fb3d322
regression: static func can't access const fix
...
(cherry picked from commit e7f056dfac
)
2020-05-13 16:14:08 +02:00
Thakee Nathees
72aa9ce7fc
range() with non-numeric const argument crash fix
...
(cherry picked from commit 3e10392d48
)
2020-05-13 16:08:33 +02:00
Thakee Nathees
55b4e0c44a
parser error for static func access non-static variables
...
Fix : #38408
(cherry picked from commit ce978517e0
)
2020-05-11 11:01:13 +02:00
Thakee Nathees
e417528f67
fix: dict2inst crash when constructor has arguments
...
(cherry picked from commit 9f6b20936e
)
2020-05-11 11:01:12 +02:00
Thakee Nathees
a446e8671d
autocompleting with indexing for native types added
...
Fix : #37768
(cherry picked from commit 3c45377c6e
)
2020-05-11 10:50:46 +02:00
Thakee Nathees
22053ed75f
GDScript class var type resolve bug fixed
...
Fix : #37545
(cherry picked from commit e67eb5ca36
)
2020-05-11 10:50:46 +02:00
Thakee Nathees
6b0cfc87af
more clearer unexpected statement end error messages
...
(cherry picked from commit 5758d87f09
)
2020-05-11 10:50:46 +02:00
Thakee Nathees
7111aa0688
pass keyword inside a class implemented
...
(cherry picked from commit 63ce1fc438
)
2020-05-11 10:50:46 +02:00
Thakee Nathees
f3149817ff
fixed: saving gdscript with cyclic inheritance crash the editor
...
Fix : #9609
(cherry picked from commit c2ab35bdde
)
2020-05-11 10:50:45 +02:00
janglee
d16abbdee4
Improved go-to definition (Ctrl + Click)
...
Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
(cherry picked from commit be7a353c70
)
2020-05-11 09:33:21 +05:30
Rémi Verschelde
aa57bb0473
Merge pull request #38482 from RandomShaper/improve_yield_3.2
...
Fix object leaks caused by unfulfilled yields (3.2)
2020-05-09 22:03:00 +02:00
Pedro J. Estébanez
64344e6d1d
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:53:47 +02:00
Steven Schoen
40125c7cce
Mention offending function name in "Indented block expected" error
...
(cherry picked from commit e6e5ba32cd
)
2020-05-04 16:10:22 +02:00
Tom Evans
2859ceec6f
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
(cherry picked from commit bd081df519
)
2020-05-01 10:56:58 +02:00
Thakee Nathees
1a4530e84c
export var type reduce() implemented
...
(cherry picked from commit cd487201c6
)
2020-05-01 10:56:58 +02:00
Pedro J. Estébanez
68cca6e619
Fix leaked objects when game ends with yields in progress
2020-04-29 14:13:36 +02:00
Tom Evans
3bd5fc2e5e
Mark assert lines as safe in gdscript
...
Now calling _reduce_node_type with debugging enabled to determine
if assert line is safe. Part of doing this required the assert line
to be stored away. Now the AssertNode line is being correctly set.
Newlines are now marked safe always
(cherry picked from commit 8dc8833782
)
2020-04-27 10:10:20 +02:00
Umang Kalra
94d0f34f70
Fixed the bool _static logic
...
(cherry picked from commit b192c7d1ac
)
2020-04-27 10:09:49 +02:00
Thakee Nathees
95f6bdfa78
GDScript class name existance check enhanced
...
(cherry picked from commit 62280c3d47
)
2020-04-23 11:10:51 +02:00
Thakee Nathees
12c776dba3
line unsafe for indexing with known base type & unkown identifier
...
(cherry picked from commit 0780ad2800
)
2020-04-23 11:10:28 +02:00
Stoofin
243711e77f
Pattern bind counts as assignment
...
Fixes #34697
(cherry picked from commit 44281f233d
)
2020-04-23 11:10:06 +02:00
Rémi Verschelde
253fc093b8
DocData: Skip unexposed classes
...
Properly expose classes that we actually want accessible.
(cherry picked from commit 0ef8bcac4d
)
2020-04-21 14:15:34 +02:00
Thakee Nathees
3d69fe95e5
autocomplete for disconnect, is_connected implemented
...
(cherry picked from commit efe90fce01
)
2020-04-16 12:47:19 +02:00
Thakee Nathees
3658f7127e
`:=` fails on some nodes fix : #37357
...
(cherry picked from commit bdd7048cb5
)
2020-04-16 11:46:23 +02:00
Thakee Nathees
df87601c88
Fix for loop range bug: #37358
...
(cherry picked from commit 0b5bad78c0
)
2020-04-06 20:58:21 +02:00
Thomas ten Cate
c2469d0c6d
Add missing docs for assert message in GDScript
...
Seems like this was overlooked in PR #31142 . See also issue #17082 .
(cherry picked from commit 4c3c73ef9c
)
2020-04-06 18:17:59 +02:00
Rajat Goswami
19e71f94d8
Adding missing include guards to header files identified by LGTM.
...
This addresses the issue godotengine/godot#37143
(cherry picked from commit 2ecf928ae3
)
2020-03-25 11:38:54 +01:00
Thakee Nathees
5798c8135f
logic error in gdscript_parser.cpp for-loop-range
...
there was a logic error in for loop range argument that
check if all of the argument were constants, fixed
(cherry picked from commit bcbcf0f1ea
)
2020-03-25 09:45:47 +01:00
Thakee Nathees
40b53bc29a
duplicate arguments in a function handled
...
(cherry picked from commit 5424b626f9
)
2020-03-25 09:44:51 +01:00
Rafael Delboni
5736e43fe4
fix: Return only scenes for script owners on LSP completion
...
Fix : #36680
(cherry picked from commit 2f08f4ef4e
)
2020-03-25 09:44:09 +01:00
Rafael Delboni
ecfe9c24a2
Improve LSP completion using scene owner
...
Fixes : #36473
(cherry picked from commit 06bce137e3
)
2020-03-25 09:43:49 +01:00
Oliver Frank
41500249e3
Fix crash after closing a GDScript LSP session
...
(cherry picked from commit ed482f6167
)
2020-03-25 09:43:28 +01:00
of9
511105be67
Migrating language server from Websockets to raw TCP
...
(cherry picked from commit 24b27043fe
)
2020-03-25 09:43:05 +01:00
Thakee Nathees
708aab7920
typo in gdscript_workspace.cpp/remove_cache_parser() fixed
...
(cherry picked from commit 07c99340d1
)
2020-03-09 09:51:59 +01:00
Hugo Locurcio
d679edfa7f
Add a practical example for `@GDScript.linear2db()`
...
One of its most common applications in games is for volume sliders.
See https://www.dr-lex.be/info-stuff/volumecontrols.html for
more information.
(cherry picked from commit a6fd6b78dd
)
2020-03-04 12:40:14 +01:00
Hugo Locurcio
21a45dda7a
Improve the `@GDScript.inverse_lerp()` documentation
...
This closes https://github.com/godotengine/godot-docs/issues/2589 .
(cherry picked from commit 6b5573700b
)
2020-03-04 12:40:14 +01:00
geequlim
57151c5e31
Fix hover symbol content position
...
(cherry picked from commit 03d2d01082
)
2020-02-14 16:08:14 +01:00
Francois Belair
f6968d5f17
Fix static functions loop using class' functions
...
Besides being incorrect, it also caused a hard editor crash for purely
static classes or classes with more static functions than methods.
2020-01-28 14:19:09 -05:00
Rémi Verschelde
4cee1cda5e
Merge pull request #35589 from akien-mga/doc-drop-category-property
...
doc: Drop unused 'category' property from header
2020-01-26 16:34:13 +01:00
Rémi Verschelde
09ced94dd4
doc: Do not expose Variant::NIL as a type in the class reference
...
Fix signals Variant arguments incorrectly listed as Nil.
Fixes #12520 .
2020-01-26 16:08:11 +01:00
Rémi Verschelde
2d20fc39aa
doc: Drop unused 'category' property from header
...
We already removed it from the online docs with #35132 .
Currently it can only be "Built-In Types" (Variant types) or "Core"
(everything else), which is of limited use.
We might also want to consider dropping it from `ClassDB` altogether
in Godot 4.0.
2020-01-26 16:02:39 +01:00
Rémi Verschelde
cbdbfb00ca
doc: Document named color constants
...
Busywork but it's good for our completion rate :)
2020-01-26 12:08:16 +01:00
Rémi Verschelde
36e11d1c34
Merge pull request #35412 from DaividFrank/check_overriding_self
...
Disabled re-assigning 'self'
2020-01-22 20:47:52 +01:00
DaividFrank
badabdf8b9
GDScript: Added checks in assign operations to disable re-assigning 'self'
2020-01-22 19:00:54 +02:00
Rémi Verschelde
4faaf6089a
Remove unused #if 0'ed code
2020-01-21 21:41:54 +01:00
Dani Frank
8f5e424c66
Fix subclass finding in extend statement for sub-sub classes
...
lookup was always done on top level script instead of advancing to subclass each time.
this commit changes the lookup to always be at last found subclass
2020-01-18 11:55:27 +02:00
ChibiDenDen
9ffa9a6bac
Fix constant access in base class through subclass instance
...
Fixes as issue where a subclass calls a base class method that tries to access a constant from the script.
The original code went through every ower class, and for each owner, went through its inheritance tree.
This seems like the wrong order, the modified code goes to each base class, and for each base class goes through the owner tree.
This is more in line with what the parser does, as the current impelemtation allows an access that the parser does not support.
This change should not negatively affect existing code due to the way the parser works
2020-01-17 00:12:45 +02:00
Rémi Verschelde
8b0e2a409b
Merge pull request #35218 from bojidar-bg/26691-parse-error-errors
...
Fix errors raised when showing parse errors in the editor
2020-01-16 22:32:49 +01:00
Bojidar Marinov
da5b138e64
Fix errors raised when showing parse errors in the editor
...
Fixes #26691
2020-01-16 22:12:24 +02:00
Rémi Verschelde
f2aa99a8e2
Merge pull request #35201 from bojidar-bg/27582-gdfunction-validate-instance
...
Validate instances of objects before trying to check their type in GDScript
2020-01-16 15:57:44 +01:00
Rémi Verschelde
4998983bd5
Merge pull request #35199 from dalexeev/master
...
Fix function arguments hint format in GDScript editor
2020-01-16 15:53:28 +01:00
Rémi Verschelde
cd7b51b943
Merge pull request #35102 from ChibiDenDen/reuse_orphaned_subclass
...
#34161 : Keep a weak reference to orphan subclasses to reuse on class reload
2020-01-16 15:49:52 +01:00
Bojidar Marinov
dc4455d819
Validate instances of objects before trying to check their type in GDScript
...
Fixes #27582
2020-01-16 16:39:59 +02:00
Bojidar Marinov
19ce2d5159
Fix slight problems related to default values of exported typed arrays
2020-01-16 14:50:29 +02:00
Danil Alexeev
45b510b332
Fix function arguments hint format in GDScript editor
...
for consistency with the format of the documentation:
"type func_name(arg1: type, arg2: type)"
2020-01-16 15:41:02 +03:00
ChibiDenDen
86aa12e806
Keep a weak reference to orphan subclasses to reuse on class reload
2020-01-15 22:54:01 +02:00
Houkime
e1a0ce5af9
Prevent GDScript language server from listening to external hosts by default
...
* Add bind_ip property to WebSocketServer defaulting to "*" (listen to everyone)
* Set default for GDscript Language Server to listen only to localhost
Fixes potential security issue with GDScript language server being exposed to the
broad net by default.
Since it is the server which primary usage is to provide utility to the local
editor there is no need to expose it.
2020-01-15 00:29:59 +00:00
Rémi Verschelde
40f0649e5b
Fix typos with codespell
...
Using codespell 1.16.0.
See ab3bccdb78
for procedure.
2020-01-15 00:49:52 +01:00
Dani Frank
d6f10cd08e
Add fully_qualified_name for GDScript class
2020-01-14 17:33:33 +02:00
George Marques
1d129f9bec
GDScript: Check function arguments on release too
...
Needed because otherwise the certain type operations (such as type
casting) used as a function argument might become unresolved on release,
causing a compilation failure.
Fix #28680
2020-01-13 15:58:53 -03:00
Rémi Verschelde
e32d232053
Merge pull request #35076 from vnen/gdscript-type-match-assign
...
Type match on assignment only if operators have type
2020-01-13 13:14:57 +01:00
George Marques
e6060706ca
GDScript: Type match on assignment only if operators have type
...
This ensures that a value without type won't be wrongly assigned to a
typed variable when the types mismatch.
2020-01-13 08:51:24 -03:00
Geequlim
d5e1890c85
Fix infinite loop error in document link parsing
2020-01-13 19:23:29 +08:00
geequlim
e804eebfe5
Remove completion triggers for ',' and '(' which may conflict with signature helper
2020-01-11 23:51:25 +08:00
geequlim
d901d5993b
Allow enable/disable threading for LSP server
...
Restart LSP server when configurations change without restart the editor
2020-01-11 23:50:32 +08:00
George Marques
4c20d9407d
GDScript: Forbid using "script" as member name
...
Avoids the user breaking things by creating a "script" variable with
something else, effectively overwriting the "script" slot on Object.
2020-01-10 19:43:33 -03:00
Rémi Verschelde
0d2993659b
Merge pull request #34978 from GodotExplorer/lsp-fix-bracket-completion
...
LSP: Fix bracket completion for functions with one argument
2020-01-10 07:58:26 +01:00
Rémi Verschelde
09aa12a0dd
Merge pull request #34958 from vnen/gdscript-is-check-valid-instance
...
GDScript: Validate object instance on `is` operation
2020-01-10 07:40:56 +01:00
Geequlim
6190d42825
LSP: Fix bracket completion for functions with one argument
2020-01-10 14:23:01 +08:00
George Marques
76678b2609
GDScript: Fix type name on error message for function parameters
2020-01-09 15:50:06 -03:00
George Marques
1aef8bfeb1
GDScript: Fix resolution of default parameter values
...
Fix #26556
2020-01-09 15:42:31 -03:00
George Marques
3718f8f592
GDScript: Validate object instance on `is` operation
...
Avoids crashes on debug mode. Instead it now breaks the execution and
show the error in-editor. Will still crash on release.
Also add a similar check to Marshalls to ensure the debugger doesn't
crash when trying to serialize the invalid instance.
2020-01-09 13:59:33 -03:00
George Marques
cc9ca9eb34
GDScript: Don't re-evaluate index on assigment with operation
...
Pass the calculated index from the stack and use the same to get and set
the value. This avoids a function with side effects being evaluated
twice when using indexing in an assignment with operation statement
(e.g. a[function()] += 1).
2020-01-09 10:43:29 -03:00
Rémi Verschelde
e97e951741
Merge pull request #34948 from vnen/gdscript-copy-constructor
...
GDScript: Allow copy constructor for built-in types
2020-01-09 13:42:10 +01:00
George Marques
41ed905c1a
GDScript: Allow copy constructor for built-in types
...
Those are implicitly defined in Variant.
2020-01-09 09:03:09 -03:00
George Marques
7d4fc79eb3
Add GDScript warning for standalone expression
...
This makes the error message clearer as it might be used to call
functions with side effects.
2020-01-09 08:30:14 -03:00
George Marques
e7b7dc57fc
GDScript: set assign operation on local var made by match
...
This is needed in a all local variables with assigment to properly set
the typed operation.
Fix #34928
2020-01-08 19:28:07 -03:00
Rémi Verschelde
5a8107f70a
Merge pull request #34920 from GodotExplorer/lsp-signatureHelper
...
GDScript LSP: Implement signatureHelp
2020-01-08 18:29:39 +01:00
Rémi Verschelde
c456d87ee6
Merge pull request #34918 from vnen/gdscript-assign-op
...
GDScript: enable type checks on release mode
2020-01-08 18:22:38 +01:00
geequlim
d35c018a7a
GDScript LSP: Implement signatureHelp
...
Enable smart resolve default to true as it is required for script symbol lookup
2020-01-09 00:57:54 +08:00
George Marques
d26414f9fe
GDScript: enable type checks on release mode
...
Also make builtin GDScript functions report return type as Variant in
release so type is converted when needed.
2020-01-08 12:38:18 -03:00
George Marques
899f7999b4
GDScript: properly set type of local variable initialization
...
Properly sets the type of the identifier for the local variable
that is stored in the assignment operation. This makes sure that the
compiler is aware of typing for local variables when they are
initialized with the declaration.
2020-01-08 11:36:50 -03:00
geequlim
eb5861f9f1
GDScript LSP: Implement goto declaration
2020-01-04 20:02:26 +08:00
Bojidar Marinov
b93b7aca74
Allow the usage of newlines in export hints
...
Fixes #34689
2020-01-02 18:03:11 +02:00
Rémi Verschelde
a7f49ac9a1
Update copyright statements to 2020
...
Happy new year to the wonderful Godot community!
We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.
Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Haoyu Qiu
078c0d75f2
Cleans up headers included in editor_node.h
2019-12-24 21:46:05 +08:00
Rémi Verschelde
74977277fa
Merge pull request #34280 from zaksnet/fix-yield-documentation
...
Fix documentation for yield
2019-12-16 08:49:32 +01:00
Haoyu Qiu
468fcd80bb
Updates docs for GDScript built-in functions
...
* Adds description for `ord()`
* Adds relationship description between `char()` and `ord()`
* Describes the argument of `char()` as Unicode code point instead of ASCII code
* Fixes wrong interval notation in `randi()` description
2019-12-15 19:06:29 +08:00
George Marques
cb887324e6
GDScript: Convert values when setting member variables
...
This allows doing: self.x = 1 even if self.x is declared as float.
2019-12-13 12:51:53 -03:00
George Marques
475d7f0e52
GDScript: Fix type conversion in assignment with operation
2019-12-13 12:51:08 -03:00
Zak
0fd7186971
Fix documentation for yield
...
#33872 PR was misleading as i though inheritance from GDScriptFunctionState was optional.
2019-12-13 11:17:12 +02:00
Rémi Verschelde
f065b34e96
Merge pull request #34286 from bojidar-bg/31818-cast-autocomplete
...
Fix GDScript autocompletion with "as" or typed variables
2019-12-12 14:53:38 +01:00
Bojidar Marinov
a665b3878b
Fix GDScript autocompletion with `as` or typed variables
...
Fixes #31818 , fixes #33434
2019-12-12 01:16:23 +02:00
Michael Alexsander
6cc3bb2d9b
Add note in 'load()' docs that the path must be absolute
2019-12-11 17:14:58 -03:00
Rémi Verschelde
98c3990f7d
Merge pull request #34271 from vnen/gdscript-unused-class-variable-disable
...
Disable GDScript warning for unused class variable by default
2019-12-11 16:27:42 +01:00
Rémi Verschelde
df2e3e3f7f
Merge pull request #33018 from Xrayez/fix-inst2dict-getters
...
Fix `inst2dict` calling to getters to retrieve value
2019-12-11 15:06:38 +01:00
George Marques
cbf5641a74
Disable GDScript warning for unused class variable by default
2019-12-11 11:02:07 -03:00
Rémi Verschelde
2845e6a21a
Merge pull request #34040 from qarmin/unused_variable_more_precise_numbers
...
Removed unused variables, add some constants numbers
2019-12-10 08:25:31 +01:00
Rafał Mikrut
ed1c4bc77d
Removed unused variables, add some constants numbers
2019-12-10 05:13:02 +01:00
Rémi Verschelde
4eff13d768
doc: Markup fixes for enums and constants
2019-12-06 23:09:20 +01:00
Rémi Verschelde
f326913f4d
Merge pull request #34067 from bojidar-bg/32370-retype-message
...
Make error when accidentially redeclaring a variable's type clearer
2019-12-04 06:52:22 +01:00
Hugo Locurcio
1fcdeaee39
Mention that `int()` can be used as an alternative to `floor()`
2019-12-03 08:43:24 +01:00
Bojidar Marinov
79c26344e8
Make error when accidentially redeclaring a variable's type clearer
...
Fixes #32370
2019-12-02 22:26:05 +02:00
Aaron Franke
3231fca934
Add docs for is_equal_approx on structures
2019-11-30 16:52:27 -05:00
miere43
d747c61187
Fixed typo in docs for Script and GDScript classes ("exends" -> "extends")
2019-11-30 21:16:11 +03:00
Hugo Locurcio
247767eb89
Document how to bypass the unused argument/variable warning in message
...
Note that prefixing with an underscore only works with unused arguments
and local variables, not class variables and signals.
This closes #26056 .
2019-11-27 22:52:43 +01:00
Hugo Locurcio
4f14a1f59c
Remove type hint from the @GDScript class documentation
...
The current consensus in the Godot documentation is to avoid using
type hints unless they're relevant to the behavior explained.
2019-11-26 19:13:55 +01:00
Zak Stam
5cfff77ca6
Added missing documentation for yield()
...
Added some missing documentation about yield() being able to wait for a function also. I cant believe something like that was missing from the docs, it would have saved me so much time (and others i assume).
2019-11-25 18:08:18 +02:00
Rémi Verschelde
ab3bccdb78
Fix typos with codespell
...
Using codespell 1.16.0.
Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
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
```
2019-11-22 08:35:03 +01:00
Michael Alexsander
7ecaff578b
Make the script templates' blank lines conform with the official style guide
2019-11-17 08:54:43 -03:00
lupoDharkael
9254961297
Parser: Check all the arguments of the ternary operator
2019-11-15 01:29:18 +01:00
Rémi Verschelde
30d4c923cb
Merge pull request #32966 from ffaristocrat/fix-hex-parsing
...
Fix base 16 hex literal parsing
2019-11-12 23:04:20 +01:00
Micheál Keane
4b9fd961d6
Fixes #32963 by correctly parsing bin/hex literals
2019-11-12 15:57:38 -05:00
Marcel Admiraal
83069a3c0f
Remove ERR_EXPLAIN macros and the scaffolding they needed.
2019-11-11 10:57:00 +01:00
Marcel Admiraal
d18b2e599d
Remove all uses of ERR_EXPLAIN macros.
2019-11-11 10:24:04 +01:00
mashumafi
d7137a6b72
Add setting to exclude addons from script warnings
2019-11-07 23:01:22 -05:00
Rémi Verschelde
91518defa5
Merge pull request #33257 from aaronfranke/printraw
...
Document behavior of GDScript printraw
2019-11-07 13:21:09 +01:00
Rémi Verschelde
76aa975460
Merge pull request #33266 from Xrayez/inst2dict-original-path
...
Use GDScript resource path over script path for `inst2dict`
2019-11-04 08:59:30 +01:00
Andrii Doroshenko (Xrayez)
7f40b69022
Use GDScript resource path over script path for `inst2dict`
...
The resource path holds the original path which can be used to convert
a dictionary to instance consistently both within editor and exported projects
as the original path is automatically remapped from `gd` to `gdc` or `gde` in
exported projects.
2019-11-02 15:11:52 +02:00
Aaron Franke
c4e46b8800
Document behavior of printraw
2019-11-02 04:55:39 -04:00
Aaron Franke
b67f252016
Fix Color8 GDScript documentation
2019-11-02 04:48:08 -04:00
George Marques
9fcd38fc70
GDScript: validate instance before accessing it on error
...
Make sure the instance is valid before trying to access the script in
after an error happened. If the instance is not valid it's possible that
the script is invalid as well.
Fix #29623
2019-11-01 14:41:52 -03:00
George Marques
15800b4db8
GDScript: Avoid editor crashes when there's cyclic inheritance
...
Make sure the script is fully compiled before looking into the base.
2019-11-01 12:00:20 -03:00
Andrii Doroshenko (Xrayez)
56925b9c28
Provide and print error messages for JSON parsing
...
Core is not touched, only for binding and scripting.
2019-10-31 13:15:44 +02:00
PouleyKetchoupp
bcbe5b5850
Fixed leak in gdscript when creating empty WeakRef
...
Fixes #33150
2019-10-29 23:53:56 +01:00
Rémi Verschelde
c43c3747cf
Merge pull request #32808 from bojidar-bg/30937-less-strict-mixed-spacing
...
Allow mixed tabs and spaces when indentation does not depend on tab size
2019-10-25 23:16:04 +02:00
Bojidar Marinov
afbde3314a
Allow mixed tabs and spaces when indentation does not depend on tab size
...
(hopefully) Closes #30937 , fixes #32612
2019-10-25 14:54:57 +03:00
Andrii Doroshenko (Xrayez)
1b9a7e1c21
Fix `inst2dict` calling to getters to retrieve value
...
Use `GDScriptInstance` to iterate through all members directly instead.
This is similar to how `dict2inst` works and makes the serialization
behaviour more consistent.
2019-10-24 14:45:04 +03:00
Rémi Verschelde
8228b93fcd
Merge pull request #32919 from vnen/gdscript-unused-args
...
Fix wrong counting of function argument usage
2019-10-22 14:15:58 +02:00
Rémi Verschelde
e4cfb77961
Merge pull request #32903 from madmiraal/fix-27649-part9
...
Remove duplicate valid value check in gdscript_tokenizer.cpp.
2019-10-22 13:51:28 +02:00
Rémi Verschelde
fddc60c85c
Merge pull request #32878 from EbbDrop/no_autocompletion_for_singeltons
...
Fixes auto completion for singletons
2019-10-22 13:50:25 +02:00
George Marques
05465b9693
GDScript: Add _ prefix on class name in type compatibility check
...
This makes sure that the classes internally represented with an
underscore (_) prefix, such as singletons, are still properly checked
for inheritance in the ClassDB.
2019-10-19 13:45:52 -03:00
George Marques
bb20e420af
Fix wrong counting of function argument usage
...
There's no need to subtract 1 from the assignment usages because it's
not incremented anywhere else.
Also put back the assignment with operators because they should not
count as usage if the argument is on the left side.
2019-10-19 10:59:57 -03:00
Marcel Admiraal
5b96233c34
Remove duplicate valid value check in gdscript_tokenizer.cpp.
2019-10-18 11:58:34 +02:00
EbbDrop
f70fd781fc
Fix autocompletion for singletons
2019-10-17 10:48:13 +02:00
qarmin
616ab4fac2
Small fixes to redundand code, copy paste bugs
2019-10-14 11:40:55 +02:00
HaSa1002
d9dfc4496c
fix #32588 crash in language server
2019-10-11 14:43:39 +02:00
Hugo Locurcio
7f49c5dd42
Decrease polling frequency to 20 Hz in the GDScript language server
...
This decreases the language server's CPU usage.
2019-10-10 16:42:05 +02:00
Rémi Verschelde
55ef6a0f25
Merge pull request #32671 from GodotExplorer/lsp-send-godot-class-tree
...
lsp: Send godot class tree to clients
2019-10-09 08:35:05 +02:00
Geequlim
1ab34bc3c2
lsp: Send godot class tree to clients
2019-10-09 13:40:50 +08:00
Geequlim
2b5b5874a2
lsp: Fix signature of void returned functions in native methods
2019-10-09 10:01:48 +08:00
noname1477
3659e3db9d
Fixed some obvious typos in error messages
...
In some errors, there were closing quotation marks but no opening (e. g. "Unable to iterate on object of type " +
Variant::get_type_name(container->get_type()) + "'."
2019-10-05 15:33:30 +02:00
geequlim
9f27a4838c
Format documentations to markdown only when needed
2019-10-05 14:09:38 +08:00
geequlim
e199488bc7
Add custom api `textDocument/nativeSymbol` to allow inspect native symbols from LSP clients
2019-10-04 23:00:33 +08:00
geequlim
39813939fc
Fix enumeration value of SymbolKind.
...
Add custom notification 'gdscript/show_native_symbol' to show native symbols in clients.
Close client connections when stop gdscript-lsp
2019-10-04 19:36:40 +08:00
Rémi Verschelde
d66cce0215
Merge pull request #32517 from GodotExplorer/gdscript-lsp
...
GDScript LSP server improvement
2019-10-03 13:40:09 +02:00
geequlim
6a8303f82f
Implement DocumentLink of GDScript LSP Server
2019-10-03 18:51:03 +08:00
Rémi Verschelde
c9781df316
Merge pull request #32403 from yeonghoey/enforce4space
...
Print errors when tab indent found in [codeblock]
2019-10-03 08:41:21 +02:00
geequlim
d1a6964d39
Fix codeblock formating to markdown
2019-10-03 14:22:26 +08:00
Hugo Locurcio
621bafb948
Tweak the default function definition color when using a dark theme
...
This decreases its saturation to make it less visually jarring.
The code was also refactored for clarity and to avoid repetition.
2019-10-02 09:36:47 +02:00
Yeongho Kim
d4a55fb639
Print errors when tab indent found in [codeblock]
2019-10-01 23:39:45 +09:00
Rémi Verschelde
d66d970fdb
Merge pull request #32172 from WindyDarian/gdscript_allow_null_weakref
...
Allow weakref(null) in gdscript
2019-10-01 10:35:37 +02:00
Bojidar Marinov
db89fef8fa
Highlight singletons and class_names in GDScript
...
Also, implement a small QoL change for auto-typed variables.
Closes #5739
2019-09-28 13:13:18 +03:00
Rémi Verschelde
dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
...
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin
17732fe698
Added some obvious errors explanations
2019-09-25 10:28:50 +02:00
George Marques
64d09b7de5
GDScript: Fix type resolution not being return in some cases
...
Some situations caused the parser node type to not being update when
trying to resolve the type, returning invalid data and breaking the
parsing when it shouldn't. This patch fix the behavior.
2019-09-24 18:05:20 -03:00
Rémi Verschelde
4f294b958f
doc: Sync classref with current source
...
Fix a few missing bindings or unspecified argument names and default values.
2019-09-24 11:52:06 +02:00