Commit graph

1285 commits

Author SHA1 Message Date
Haoyu Qiu
acf9870397 Fix incorrect usage for some export variables 2022-04-29 20:12:47 +08:00
Haoyu Qiu
d088128b43 Remove duplicate editor settings definitions 2022-04-27 15:26:46 +08:00
George Marques
663978e8ba
GDScript: Properly check type info in release builds
This makes sure native methods and properties have the actual type
checked to compare for compatibility and inference.
2022-04-01 18:20:37 -03:00
Hugo Locurcio
b087538119
Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
2022-03-16 23:01:02 +01:00
Haoyu Qiu
871a73341b Fix crash when is-operator right-hand-side is null 2022-03-13 23:17:25 +08:00
George Marques
f2166ba92f
GDScript: Don't coerce default values to the export hint type
This behavior is inconsistent with non tools builds and can create
issues. Instead, a warning is emitted if there's a type mismatch. If the
type can't be converted, an error is shown instead.

For the editor it gives a converted value to avoid issues with the
property editor, which expects the correct type.
2022-03-02 12:26:17 -03:00
George Marques
a3fe028809
GDScript: Infer variable types on release
Otherwise this creates an inconsistency between debug and release
builds, potentially leading to crashes.
2022-02-09 09:07:18 -03:00
Haoyu Qiu
8a42ab7a85 Fix crash when is keyword is tested against a String variable 2022-01-14 23:37:04 +08:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Rémi Verschelde
79aa64efff
Merge pull request #56296 from timothyqiu/pending-func-states 2022-01-12 16:47:56 +01:00
Max Hilbrunner
717801c9cb Fix docs links in 3.x after docs reorg 2022-01-05 11:54:52 +01:00
Hugo Locurcio
a6db1c758a
Improve lerp(), lerp_angle() and inverse_lerp() documentation
This clarifies that `lerp()` can be used both for interpolation
and extrapolation.
2022-01-04 00:41:37 +01:00
Haoyu Qiu
53af7ee482 Clear pending function states when reloading GDScript 2021-12-28 15:29:21 +08:00
Francois Belair
b8f2f48d86
Remove extraneous return to LSP
(cherry picked from commit ad01201f34)
2021-12-09 22:08:48 +01:00
Francois Belair
ba1d6b7532
Prevent LSP adding signal func to non GDScripts
(cherry picked from commit 66f1b4bf66)
2021-12-06 17:51:11 +01:00
kobewi
5caab0a8ef
Correct the doc about ease()
(cherry picked from commit 44e6655924)
2021-11-25 22:23:53 +01:00
Marcel Admiraal
4d3690eba5 Remove unimplemented methods 2021-11-18 12:47:36 +00:00
Rémi Verschelde
3ac2999f22
Replace Godot docs URL with $DOCS_URL in XML class reference 2021-11-15 17:22:47 +01:00
kobewi
175870ccc7
Show built-in script names in the debugger
(cherry picked from commit 3b320cd9fe)
2021-11-15 17:22:47 +01:00
Rémi Verschelde
b0cd38b7e3
Merge pull request #42625 from RandomShaper/fix_dict_3.2 2021-11-09 15:55:43 +01:00
Pedro J. Estébanez
a7aad78fd0 Add recursive comparison to Array and Dictionary
...and expose it to GDScript.

Co-authored-by: Emmanuel Leblond <emmanuel.leblond@gmail.com>
2021-11-09 15:08:22 +01:00
Hugo Locurcio
63d214f04b
Remove hash symbol in front of opcode error messages in GDScript
The hash symbol creates spurious issue references on GitHub if
the message is posted outside a code block, which means some issues
have a lot more references than originally intended.
2021-11-09 12:20:51 +01:00
Rémi Verschelde
2f10793467
Merge pull request #54117 from Pineapple/dont-ignore-type-mismatch-in-setter 2021-11-08 19:26:58 +01:00
Rémi Verschelde
bd828c4d81
Merge pull request #54227 from akien-mga/3.x-gdscript-multiline-indexing 2021-11-08 15:03:24 +01:00
Rémi Verschelde
14c366ddd7
Bump version to 3.5-beta 2021-11-05 16:10:17 +01:00
Rémi Verschelde
14ef65e49b
Merge pull request #54348 from akien-mga/3.x-clang-format-dont-align-operands 2021-10-28 15:43:15 +02:00
Rémi Verschelde
1b65550ec7
clang-format: Various fixes to comments alignment from clang-format 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 14:50:32 +02:00
Rémi Verschelde
42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Yuri Sizov
b3fc278dcf Ignore property groups and categories in GDScript code completion 2021-10-26 20:01:49 +03:00
Rémi Verschelde
92664f03a9
GDScript: Support multiline indexing with []
Fixes #35417.
2021-10-25 15:50:59 +02:00
Bartłomiej T. Listwon
5a7bd296af Don't ignore the type mismatch in setter function 2021-10-22 12:43:13 +02:00
Yuri Sizov
b6b65e08d1 Remove redundant String operation from GDScript enum exports 2021-10-11 02:12:30 +03:00
Rafał Mikrut
1558f4a599 Speedup parsing big GDScript files 2021-10-07 07:39:56 +02:00
Rémi Verschelde
3f05c388a1
Merge pull request #52521 from kdiduk/52499-preload-parsing-error-when-newline-encountered 2021-10-06 10:13:19 +02:00
Kirill Diduk
835143b7bd #52499 Fix parsing 'preload': increase/decrease parenthesis count 2021-10-06 09:35:21 +02:00
Rémi Verschelde
db0370cab5
Merge pull request #51086 from aaronfranke/3.x-warn-dectime 2021-10-05 12:06:03 +02:00
Hugo Locurcio
48e0212497
Add an example on iterating an array backwards
This closes https://github.com/godotengine/godot-docs/issues/3472.

(cherry picked from commit 810d8f06b7)
2021-10-04 15:15:27 +02:00
Francois Belair
6be31e559d
Fix empty line hover; fix open non-res:// script
(cherry picked from commit 572979d011)
2021-10-01 21:30:39 +02:00
Francois Belair
3754759e26 Fix extends parsing breaking if it has the cursor 2021-10-01 11:31:05 -04:00
Hugo Locurcio
fe2f24c47c
Improve the documentation for ease() and smoothstep()
This adds a cheatsheet for `ease()` and a comparison graph for
`smoothstep()`, among other things.

(cherry picked from commit 567b6436c9)
2021-10-01 08:04:20 +02:00
Francois Belair
679ce6fd0b Fix LSP crash parsing scripts of temp size 0 2021-09-30 11:11:56 -04:00
Rémi Verschelde
69b2f1dcc6
Merge pull request #53094 from Razoric480/fix-func-doc-_init 2021-09-29 15:47:37 +02:00
Francois Belair
ae3aec1dbc Makes LSP report new() as _init; fixes docstrings 2021-09-29 08:43:32 -04:00
Pedro J. Estébanez
6697e380d9 Fix check for freed object during cast 2021-09-27 19:46:49 +02:00
Francois Belair
885d905b0d Make LSP send applyEdit to connect editor signals 2021-09-25 15:22:28 -04:00
Aaron Franke
a5543bc35e
[3.x] Warn when using the dectime method
dectime has been removed in the master branch (what will be Godot 4.0)
2021-09-21 10:03:42 -05:00
Rémi Verschelde
22aab6be1c
Merge pull request #51796 from RandomShaper/dangling_obj_release_3.x
[3.x] Promote object validity checks to release builds
2021-09-21 11:48:11 +02:00
Pedro J. Estébanez
26edc6cd41 Promote object validity checks to release builds
Extra:
- Optimized the debug-only check about why the object is null to determine if it's because it has been deleted (the RC is enough; no need to check the ObjectDB).
- Because of the previous point. the debugger being attached is not required anymore for giving the "Object was deleted" error; from now, it only matters that it's a debug build.
- `is_instance_valid()` is now trustworthy. It will return `true` if, and only if, the last object assigned to a `Variant` is still alive (and not if a new object happened to be created at the same memory address of the old one).
- Replacements of `instance_validate()` are used where possible `Variant::is_invalid_object()` is introduced to help with that. (GDScript's `is_instance_valid()` is good.)
2021-09-21 10:39:04 +02:00
John J. Donna II
91482a00bb
LSP: Add support for custom host setting
You can now configure host in the `language_server` settings in the editor
settings.

(cherry picked from commit be6da39b8a)
2021-09-20 13:55:28 +02:00
Rémi Verschelde
187b1ec61e
Merge pull request #51095 from RandomShaper/error_cast_freed_object_3.x
[3.x] Complain if casting a freed object in a debug session
2021-09-14 22:40:17 +02:00
Pedro J. Estébanez
123d3ef935 Complain if casting a freed object in a debug session
The idea is to give the user a chance to realize a mistake that will cause a crash in a release build (or with no debugger attached).
2021-09-14 21:05:47 +02:00
Rémi Verschelde
ddfaf20f62
Merge pull request #50483 from akien-mga/3.x-ci-emscripten-2.0.25 2021-08-18 11:56:39 +02:00
Rémi Verschelde
1de8f31448
CI: Upgrade Emscripten to 2.0.25
That's the version used by current containers for Godot 3.4.

Fixes a couple stray warnings that new Emscripten/LLVM catches.
2021-08-18 11:13:34 +02:00
Jihyun Yu
5c66891048 Auto-reload scripts with external editor 2021-08-18 16:52:14 +09:00
Rémi Verschelde
632844e464
Merge pull request #51320 from pycbouh/docs-extract-theme-items-3.x
[3.x] Add theme item descriptions to the online documentation
2021-08-13 22:39:09 +02:00
Rémi Verschelde
f0b37b1519
doc: Point URLs to 3.4 version of the online docs 2021-08-12 17:08:10 +02:00
Rémi Verschelde
a418d09617
Merge pull request #51166 from RandomShaper/fix_can_reset_3.x 2021-08-09 09:19:25 +02:00
Francois Belair
6db17a523e Fix LSP completion crashing on sceneless scripts 2021-08-06 15:31:04 -04:00
Yuri Sizov
fcbe5a3fde Add theme item descriptions to the online documentation 2021-08-06 18:20:51 +03:00
Francois Belair
1f0fa16a15
Fix LSP parsing get_node only from the scene root
(cherry picked from commit 03f8fa9f62)
2021-08-06 11:45:08 +02:00
Rémi Verschelde
63047093c9
Merge pull request #48616 from Razoric480/lsp-3x-rename
Implement LSP didSave notify and rename request [3.x]
2021-08-04 20:28:16 +02:00
Rémi Verschelde
f5836b40d4
doc: Use self-closing tags for return and argument
For the time being we don't support writing a description for those, preferring
having all details in the method's description.

Using self-closing tags saves half the lines, and prevents contributors from
thinking that they should write the argument or return documentation there.

(cherry picked from commit 7adf4cc9b5)
2021-08-03 10:20:19 +02:00
Pedro J. Estébanez
7426b3fa91 Add Script::inherits_script()
Partial cherry-pick of 5d4dc2d45c.

Co-authored-by: Juan Linietsky <reduzio@gmail.com>
2021-08-02 15:18:30 +02:00
Francois Belair
02bc1bf355 Fix LSP SymbolKind reporting wrong types
Classes were properties, functions interfaces, etc.
2021-07-24 16:25:47 -04:00
Hugo Locurcio
069281d58f
Improve documentation for GDScript constants
(cherry picked from commit 8ff8c1e5f8)
2021-07-24 00:59:35 +02:00
Francois Belair
802bb9c01f Implement LSP didSave notify and rename request 2021-07-17 11:50:17 -04:00
Francois Belair
5774098a91
Implement didClose notification in LSP
(cherry picked from commit 10429019ad)
2021-07-13 10:20:02 +02:00
Francois Belair
59d72279ae
Translate file path to URI on LSP symbol requests
(cherry picked from commit a56c2e459b)
2021-06-29 13:12:15 +02:00
Marcel Admiraal
7e03bd1671 Remove duplicate WARN_PRINTS macro 2021-06-18 12:57:59 +01:00
Pedro J. Estébanez
2d1943b8d1
Fix slow load/save of scenes with many instances of the same script
(cherry picked from commit 2ca6b9c610)
2021-06-17 12:47:54 +02:00
Marcel Admiraal
5a58516231 Remove duplicate ERR_PRINTS macro 2021-06-16 11:56:25 +01:00
Hugo Locurcio
a38b447413
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-25 00:31:39 +02:00
Rémi Verschelde
eb78f80f03
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
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
```
2021-05-20 12:56:56 +02:00
Rémi Verschelde
6355877c0d
Merge pull request #47863 from mphe/same_line_warning_ignore
Allow warning-ignore in the same line as the respective warning
2021-05-18 15:08:00 +02:00
Pedro J. Estébanez
817ffc01e1
Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-16 17:52:31 +02:00
Rémi Verschelde
4185a22ca8
Merge pull request #48131 from LightningAA/fix-48113-3.x
[3.x] Fix Array.max() navigating to @GDScript.max()
2021-05-06 20:42:23 +02:00
Rémi Verschelde
140350d767
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
2021-05-05 15:02:01 +02:00
Rémi Verschelde
a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde
64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
kleonc
f04a964627 Make posmod use int64_t instead of int 2021-05-03 22:03:16 +02:00
Rémi Verschelde
70ae90e0e8
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.

Backport of #48239.
2021-04-29 12:34:11 +02:00
Rémi Verschelde
c3272997cd
doc: Update classref headers with 3.4 version 2021-04-26 13:15:29 +02:00
Francois Belair
1f54a75310
Make LSP update the filesystem of changed scripts
This updates global classes and exposes base member variables.
Fixes #39713

(cherry picked from commit b16bb33a5b)
2021-04-26 12:20:28 +02:00
Lightning_A
2c4aa50648 Fix Array.max() navigating to @GDScript.max() etc. 2021-04-23 09:40:24 -06:00
Marvin Ewald
3715ea268f Allow warning-ignore in same line 2021-04-13 13:55:33 +02:00
Rémi Verschelde
ed44e2806f
doc: Fix markup issues in classref 2021-04-07 11:52:44 +02:00
Francois Belair
4e8e887748 Implement LSP didDeleteFiles to clear diagnostics
Fixes #43133
2021-04-01 13:41:53 -04:00
Rémi Verschelde
015973df04
doc: Make all tutorial links point to 3.3 branch of docs 2021-03-26 10:43:43 +01:00
Paul Joannon
596169d7df
class reference proofreading
(cherry picked from commit 8455e901f3)
2021-03-26 09:49:07 +01:00
Francois Belair
7f8fe58825 Make LSP parser aware of variables in sub-blocks
Fixes #43164 and Fixes godotengine/godot-vscode-plugin#207
2021-03-24 16:52:38 -04:00
Rémi Verschelde
1aba997d75
doc: Sync classref with 3.3 version bump 2021-03-23 13:40:34 +01:00
Hugo Locurcio
ee8661158c
Document the valid input range for acos() and atan()
(cherry picked from commit d359e159da)
2021-03-16 11:37:26 +01:00
Taylor C. Richberger
59b82e1b6a 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.

(cherry picked from commit 91ce8d5fff)
2021-02-25 22:34:56 +01:00
Angad Kambli
327586f582 fix minor issue in smooth step function's documentation
(cherry picked from commit 892060fa47)
2021-02-22 14:16:42 +01:00
Vignesh1-art
13871deb57 Fixed Invalid function bindings #46135
Fixed  GDScriptLanguageProtocol::notify_client - have 3 arguments, but only 2 are binded

(cherry picked from commit a5d931033e)
2021-02-18 23:46:54 +01:00
Pedro J. Estébanez
6d89f675b1 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez
4ddcdc031b Modernize Mutex
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00