Commit graph

1095 commits

Author SHA1 Message Date
Juan Linietsky
3c0059650d Added StringName as a variant type.
Also changed all relevant properties defined manually to StringName.
2020-02-21 14:25:29 +01:00
of9
24b27043fe Migrating language server from Websockets to raw TCP 2020-02-20 11:21:43 +00:00
Juan Linietsky
69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
George Marques
4d960efafc
GDScript: Remove self static reference and create one on calls
This is needed because of the new changes to Variant. The reference
counter is increased by adding it to a Variant, which means no GDScript
will be freed (or will be double freed if manually freed somewhere).
2020-02-19 09:15:16 -03:00
Rémi Verschelde
213a85521d doc: Sync classref with current source
Handle removal of Pool*Array types and other recent changes.
2020-02-18 14:02:02 +01:00
Juan Linietsky
3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Juan Linietsky
867d073b98 Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr. 2020-02-15 08:36:04 -03:00
Rémi Verschelde
54ac8eaba6 Remove more deprecated methods and code 2020-02-13 12:37:45 +01:00
Rémi Verschelde
1f39a2d3e6 Remove deprecated sync and slave networking keywords
Those keywords were deprecated for 3.1 in #22087.

Also fix token name for `TK_REMOTE`, should be "remote" like the keyword.
2020-02-13 08:59:36 +01:00
Rémi Verschelde
506df14595
Merge pull request #36142 from akien-mga/remove-deprecated-decimals
Remove deprecated decimals builtin
2020-02-12 21:48:33 +01:00
Juan Linietsky
cf8c679a23 ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits. 2020-02-12 14:24:54 -03:00
Rémi Verschelde
0f90ddbcf4
Merge pull request #35522 from AndreaCatania/rpc_opt_2
Optmized data sent during RPC and RSet calls.
2020-02-12 16:56:17 +01:00
Rémi Verschelde
bd78b9f445 Remove deprecated decimals builtin
Replaced by 'step_decimals' in 3.2 via #21425.
2020-02-12 13:39:39 +01:00
Andrea Catania
eb07e87981 Optmized data sent during RPC and RSet calls.
- Now is sent the method ID rather the full function name.
- The passed IDs (Node and Method) are compressed so to use less possible space.
- The variant (INT and BOOL) is now encoded and compressed so to use much less data.
- Optimized RPCMode retrieval for GDScript functions.
- Added checksum to assert the methods are the same across peers.

This work has been kindly sponsored by IMVU.
2020-02-12 13:36:47 +01:00
geequlim
03d2d01082 Fix hover symbol content position 2020-02-12 17:59:20 +08:00
Marcel Admiraal
f0db13502a Remove duplicate WARN_PRINT macro. 2020-02-05 11:13:24 +01:00
Marcel Admiraal
5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +01:00
clayjohn
57e27683ba Update docs to version 4.0 2020-01-31 17:15:41 -08: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