Commit graph

1285 commits

Author SHA1 Message Date
Rémi Verschelde
634f9523c2
SCons: Fix build with GDScript LSP disabled
Fixes #83947.

(cherry picked from commit bfd7a50036)
2024-04-25 16:24:13 +02:00
Mikael Hermansson
38b646ca4a
Allow LSP to process multiple messages per poll
(cherry-picked from commit e2485044a1)
2024-04-25 11:47:51 +02:00
lawnjelly
2b97d143a2
Merge pull request #62574 from kdiduk/50971-duplicate-keys-in-dictionary-literal
[3.x] Check duplicate keys in dictionary literals: enums and const variables
2024-04-09 08:34:08 +01:00
lawnjelly
75cadbabcb
Merge pull request #81089 from SysError99/3.x-dont-warm-about-return-value-discarded
[3.x] GDScript: Don't warn about `RETURN_VALUE_DISCARDED` by default
2024-04-04 13:02:22 +01:00
Kirill Diduk
52507443d3 Check duplicate keys in dictionary literals: enums and const variables
Check identifiers (const variables and unnamed enums) and named
enums when parsing dictionary literals whether the keys are not
duplicated.

In case of duplicate key is encountered, highlight the line with it
and print error message:
`Duplicate key "foo" found in Dictionary literal`

This commit is a logical continuation of the commit dab73c7 which
implemented such checks only for literal keys (which fixed #7034).

Apart from that, this commit also fixes the issue with the error
message itself, which was shown one line below the duplicated key
in case it was the last one in the dictionary literal and there
was no hanging comma.

Also, the format of the error message has been changed so that now
the error message also contains the value of the key which is duplicated.
Instead of `Duplicate key found in Dictionary literal`, it now prints
`Duplicate key "<value>" found in Dictionary literal`

Fixes #50971
2024-03-25 00:07:51 +01:00
Danil Alexeev
e922e49b13
[3.x] GDScript: Fix get_method_list for custom functions 2024-02-07 10:10:32 +03:00
Rémi Verschelde
f37ff9e254
Merge pull request #79123 from dalexeev/3.x-gds-prevent-native-class-shadowing
[3.x] GDScript: Prevent native class shadowing
2024-01-05 11:06:31 +01:00
Rémi Verschelde
e236747b31
Merge pull request #84475 from timothyqiu/3.x-image-links
[3.x] Fix image links to `godot-docs` repository
2023-11-14 11:37:42 +01:00
Haoyu Qiu
5302868446 Fix image links to godot-docs repository 2023-11-05 16:53:53 +08:00
Jason Knight
4285c44b47 Far faster and more efficient method of checking if an identifer refers an autoload. 2023-10-23 12:13:12 -06:00
ryanabx
22c9ac1540 [3.x] Add --lsp-port as a command line argument 2023-09-20 23:59:50 -05:00
SysError99
2b3d52a7d0 [3.x] Don't warn about RETURN_VALUE_DISCARDED by default 2023-08-29 02:47:33 +07:00
Hugo Locurcio
9cde5e2977
Document how to use logarithm of base 10 with log()
(cherry picked from commit 3c4f0ca9c6)
2023-08-28 17:27:13 +02:00
Danil Alexeev
3d98247678
[3.x] GDScript: Prevent native class shadowing 2023-07-06 20:32:30 +03:00
lawnjelly
6f8e632848 Make acos and asin safe
A common bug with using acos and asin is that input outside -1 to 1 range will result in Nan output. This can occur due to floating point error in the input.

The standard solution is to provide safe_acos function with clamped input. For Godot it may make more sense to make the standard functions safe.
2023-05-11 09:51:44 +01:00
HolonProduction
8dae3d71b2 Suggest class_name in 3.x autocompletion. 2023-04-22 16:29:14 +02:00
Rémi Verschelde
26a584179c
Merge pull request #74794 from lawnjelly/gdscript_parser_hashtable
[3.x] Use hash table for GDScript parsing
2023-03-12 16:19:07 +01:00
lawnjelly
19f2006ec0 Use hash table for GDScript parsing
GDScript now uses hash table for lookup of type lists / functions / keywords, instead of linear String comparisons.
2023-03-12 14:55:31 +00:00
lawnjelly
ef914dac31 GDScriptParser - don't use index operator on linked list
Index operators are super slow with linked lists. This came up in profiling the parsing, iterating sequentially using iterator is much faster.
2023-03-11 17:05:12 +00:00
Rémi Verschelde
1426cd3b3a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".

Backported from #70885.
2023-01-10 15:26:54 +01:00
Rémi Verschelde
aa9265928c
Merge pull request #70786 from Calinou/gdscript-fix-dict2inst-init-parameters-3.x
[3.x] Make `dict2inst` to work with arbitrary `_init` parameters
2023-01-09 14:18:30 +01:00
SaracenOne
9fa4d3b1b0 Fix local variables not showing when breaking on final line
(cherry picked from commit 657b9b6596)
2023-01-09 09:46:27 +01:00
Andrii Doroshenko (Xrayez)
accdd575f6
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.
2022-12-31 23:57:35 +01:00
Lamia
a412922c2b
LSP: Improve handling of file URI scheme
Fixes #63205.

(cherry picked from commits 3fa943fe23,
42a16ef76e and
2ff69d6181)
2022-12-12 15:58:20 +01:00
ray90514
7afbd5904e
Fix Script editor completion doesn't suggest members of a script for type hints 2022-12-12 13:36:32 +01:00
Hugo Locurcio
5e0ef339ff Document print_stack() and get_stack() requiring a debugger connection
(cherry picked from commit 530e31d4a3)
2022-12-12 14:55:23 +08:00
smix8
d955d4a1c1 Fix GDScript export hint for Navigation2D layer names 2022-10-04 10:32:57 +02:00
dzil123
1e4f47ffe0 Fix variables highlighting as types 2022-09-17 01:24:19 -07:00
Hugo Locurcio
60031ea275 Improve range_lerp() and related methods documentation
(cherry picked from commit bd19c9a95c)
2022-08-08 09:44:37 +02:00
Rémi Verschelde
14c9325b5d
Merge pull request #62408 from Razoric480/raz/fix-no-cache
[3.x] Fix nested resources being cached if no-cache argument used
2022-08-05 23:43:54 +02:00
Rémi Verschelde
5197dc6c9e
Merge pull request #61993 from kdiduk/gdscript-fix-inner-class-on-single-line
Fix inner class parsing when statement after colon is on the same line
2022-08-05 22:36:21 +02:00
Rémi Verschelde
0a8d5d7098 Bump version to 3.6-beta 2022-08-05 18:51:38 +02:00
Rémi Verschelde
818f1eed31 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 14:53:37 +02:00
Dallon Feldner
a99cc8bc29 Don't print redundant errors when parsing GDScript 2022-07-22 11:02:29 -05:00
Haoyu Qiu
a3b282c6cc Fix doc for print_debug 2022-07-20 21:17:56 +08:00
Francois Belair
2ceb93bbef Fix custom res caching sub-res even if no-cache
Fixes #59686, fixes #59752
2022-07-13 11:18:26 -04:00
janglee
00c6cdd793 GDScript: Fix autocompletetion showing class names with an underscore
Fixes #35469.
2022-07-05 12:29:23 +02:00
Rémi Verschelde
06f4a28306 Update docs links still pointing to 3.4 2022-06-29 12:03:04 +02:00
Kirill Diduk
5bcc3d476c Fix parsing inner class declaration when "pass" keyword is on the same line
Implement a special case for allowing "pass" keyword in one-liner class
declaration, to be consistent with Python style.

```
class TestClass: pass
```

This commit fixes #56703
2022-06-21 10:04:26 +02:00
Haoyu Qiu
b43fdea0d5 Classref typo fixes and improvements 2022-06-17 15:19:31 +08:00
Kurt Lachmann
c07d1d0de8 Use insertText from the internal autocompletion
* GDScriptLanguage::complete_code already adds parentheses to function calls, and does this a lot smarter than the language server right now.
* Instead of the previous naive approach we now reuse the same logic as the internal editor.
* For this to have any effect we also have to send the `insertText` field already during the completionRequest and not only during resolve.

(cherry picked from commit bbb07ff8cb)
2022-06-16 10:11:33 +02:00
smix8
8bd7c6188b [3.5] Update NavigationServer backport
Backports features and bugfixes from current Godot 4.0 to 3.5 and brings functions and codebase of both version largely in sync to make tutorials more compatible and future backports easier.
2022-06-14 05:55:14 +02:00
SnailRhymer
b94a0d486d Make Lookup Symbol recognize assert, preload, and yield in the script editor 2022-06-01 22:21:36 +01:00
Rémi Verschelde
88dba8e625 Fix typos with codespell
Using codespell 2.2-dev from current git.
2022-05-23 21:41:46 +02:00
George Marques
3a8f2dda01
GDScript: Keep builtin method info on release builds
This is so type inference still works properly after exporting the
project.
2022-05-17 11:01:12 -03:00
Eduardo Rodrigues
2398db0f34 Improve description for GDScript built-in range
Rewrites the definition of how the function works.
Reworks the style of the examples and adds a negative range example.
Changes the while loop to a range loop in the array backwards example.

(cherry picked from commit b2841ce194)
2022-05-16 17:14:43 +02:00
Rémi Verschelde
5e693b6d84 Fix warnings found by Emscripten 3.1.10
Fix `-Wunused-but-set-variable`, `-Wunqualified-std-cast-call`, and
`-Wliteral-range` warnings.

(cherry picked from commit d8935b27a9)
2022-05-16 16:38:26 +02:00
Rémi Verschelde
c3065e2186
Merge pull request #60773 from timothyqiu/rand-doc 2022-05-05 18:10:14 +02:00
Haoyu Qiu
84cc0c9c47 Improve documentation of rand_range 2022-05-05 21:52:30 +08:00
Haoyu Qiu
86b14496b1 Document lerp_angle behavior when angles are approximately PI apart
(cherry picked from commit 492903a0b2)
2022-05-05 13:45:29 +02:00