Commit graph

2762 commits

Author SHA1 Message Date
Rémi Verschelde
25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
ocean (they/them)
861743cd04 GDScript: add errors when calling unimplemented virtual functions
This PR does a small refactor of how method flags are handled in the GDScript analyzer.
This way, it adds support for the analyzer to use any of MethodInfo's flags, where previously
it could only use METHOD_FLAG_STATIC and METHOD_FLAG_VARARG.

As a side-effect, this also normalizes behavior between editor and release templates, which fixes #76938.

The tests added also brought a different issue to light, where using `super()` appears to generate a
return variable discarded on calling super's _init(), which doesn't have a return value. This should be
tackled in a different PR, which will have to change the output of this PR's tests.
2023-06-15 07:16:31 -04:00
Rémi Verschelde
3a319daa99
Merge pull request #77351 from anvilfolk/super-discard
GDScript: do not RETURN_VALUE_DISCARDED for `super()` inside `_init()`
2023-06-15 10:39:59 +02:00
rune-scape
fcdd926881 GDScript: Strings and StringNames match 2023-06-14 19:24:28 -07:00
Danil Alexeev
fba8cbe6db
GDScript: Fix repeated _ are allowed after decimal point 2023-06-14 21:47:12 +03:00
Rémi Verschelde
72b8d397d0
GDScript: Further restrict test error output for C++ errors
MSVC and GCC/Clang also have different function names...
2023-06-14 13:28:52 +02:00
Rémi Verschelde
c40adf027d
GDScript: Only include script file path in test error output
Errors originating in C++ files cause unnecessary diffs whenever the engine is updated
(line number changes, etc.) and would cause CI failures due to different formatting
of the file path on Windows (backslashes, worked around here anyway) and when using
SCU builds (`../scu` insert).
2023-06-14 10:54:49 +02:00
Rémi Verschelde
5145098e6e
Merge pull request #78138 from KoBeWi/are_we_clear
Clear SelfList when destroying GDScriptLanguage
2023-06-14 09:25:34 +02:00
Rémi Verschelde
8b62c52d1c
Merge pull request #75419 from vonagam/fix-super-classes-in-array-literals
GDScript: Allow elements of a parent class in a typed array literal
2023-06-14 09:23:32 +02:00
Danil Alexeev
ddd9aa11b3
Clarify @rpc annotation arguments docs 2023-06-13 21:33:48 +03:00
Rémi Verschelde
eb86dabee0
Merge pull request #77151 from dalexeev/gds-fix-call-static-from-non-static
GDScript: Fix calling static func from non-static is allowed
2023-06-13 18:54:19 +02:00
kobewi
c646f7df70 Clear SelfList when destroying GDScriptLanguage 2023-06-12 16:04:26 +02:00
Rémi Verschelde
577ab3c565
Merge pull request #75746 from ajreckof/order_autocomplete
Sort code autocompletion with rules
2023-06-08 18:14:31 +02:00
Danil Alexeev
049a49cac0
GDScript: Fix doc comment parsing (newlines and spaces) 2023-06-05 16:00:46 +03:00
Danil Alexeev
f3bf75fbb4
GDScript: Reset local variables on exit from block 2023-06-02 13:20:19 +03:00
Ninni Pipping
5e3c625e24 Add more info on the nature of NAN 2023-05-30 15:38:10 +02:00
Yuri Sizov
490a76edc8
Merge pull request #76526 from MewPurPur/improve-docs-top-sections-CORE
Overhaul the top sections of the class reference (Core classes)
2023-05-29 17:08:40 +02:00
Haoyu Qiu
3e88c4cd5c Fix extraction of chained tr() calls 2023-05-27 10:38:37 +08:00
ajreckof
006e899bb3 sort code completions with rules
Fixups

Add levenshtein distance for comparisons, remove kind sort order, try to improve as many different use cases as possible

Trying again to improve code completion

Sort code autocompletion options by similarity based on input

To make it really brief, uses a combination `String.similiary`, the category system introduced in a previous PR, and some filtering to yield more predictable results, instead of scattering every completion option at seemingly random.

It also gives much higher priority to strings that contain the base in full, closer to the beginning or are perfect matches.

Also moves CodeCompletionOptionCompare to code_edit.cpp

Co-Authored-By: Micky <66727710+Mickeon@users.noreply.github.com>
Co-Authored-By: Eric M <41730826+EricEzaM@users.noreply.github.com>
2023-05-23 05:12:34 +02:00
ocean (they/them)
25c90836fd GDScript: do not warn of return value discarded for super() inside _init()
DO NOT BATCH MERGE WITH #77324, WILL RESULT IN BROKEN CI

Currently, calling super() inside _init() throws a
RETURN_VALUE_DISCARDED warning. The analyzer identifies super() as being a
constructor, which therefore returns an object of the relevant class.
However, super() isn't really a constructor by itself: in this case, it
is _part_ of the constructor, and so doesn't "return" a value.

A test case for this is already in #77324, which contains the warning. I
am duplicating it here, without the warning, and it should conflict with
the other PR.
2023-05-22 09:29:34 -04:00
Rémi Verschelde
06d337af80
Merge pull request #75943 from adamscott/fix-missing-script-type-nullptr-check
Add missing `script_type` `nullptr` check
2023-05-22 13:48:32 +02:00
VolTer
04562662d3 Overhaul the top sections of the class reference (Core classes) 2023-05-19 07:04:48 +02:00
Max Hilbrunner
ad21fb0f92 Docs: Point to @GDScript in GDscript (script impl) 2023-05-17 13:47:33 +02:00
Danil Alexeev
3bf72be625
GDScript: Fix calling static func from non-static is allowed 2023-05-17 10:25:03 +03:00
Danil Alexeev
7da3110e6b
GDScript: Fix validate_call_arg() for unresolved datatype 2023-05-15 12:13:52 +03:00
Danil Alexeev
c2fbb40e9a
GDScript: Fix warning ignoring for member variables 2023-05-12 17:43:58 +03:00
smix8
a6ac305f96 Rework Navigation Avoidance
Rework Navigation Avoidance.
2023-05-10 05:01:58 +02:00
Rémi Verschelde
1d87b36760
Merge pull request #76824 from Calinou/doc-export-pck-binary-resource-conversion
Document caveats related to exported project binary resource conversion
2023-05-09 19:28:46 +02:00
Rémi Verschelde
c2ba89d9d1
Merge pull request #76790 from achernik/master
LSP: don't send empty completion command
2023-05-09 19:28:42 +02:00
Rémi Verschelde
10ed1d87df
Merge pull request #76490 from dsnopek/dump-gdscript-docs
Dump API docs from inline GDScript comments using --doctool --gdscript-docs PATH
2023-05-09 19:28:30 +02:00
David Snopek
a64137d5dd Dump API docs from inline GDScript comments using --doctool --gdscript-docs PATH 2023-05-08 11:00:29 -05:00
Hugo Locurcio
febc674f48
Document caveats related to exported project binary resource conversion 2023-05-08 07:02:00 +02:00
Александр Черник
5715d3eb59 LSP: don't send empty completion command 2023-05-06 20:56:15 +01:00
Max Hilbrunner
921d231ad6
Merge pull request #76664 from Xenoparrot/simple-typos 2023-05-06 15:41:55 +02:00
Clay John
610877e326
Merge pull request #72288 from MewPurPur/use-string-repeat
Use `String.repeat()` to optimize several String methods
2023-05-05 09:56:48 -07:00
Max Hilbrunner
ce75c46331
Merge pull request #76650 from Koyper/gdscript_range_docs 2023-05-05 17:09:56 +02:00
UltraBIF
8106d33d0f Fixed various typos across the docs 2023-05-02 18:24:32 -04:00
Koyper
bcce315a9a Update @GDScript.xml range docs to iterate backwards. 2023-05-01 11:03:48 -05:00
VolTer
6b84e258d2 Use String.repeat() in more places 2023-05-01 02:27:46 +02:00
Rémi Verschelde
f37fc4e708
Merge pull request #76412 from dalexeev/gds-reorganize-warnings
GDScript: Reorganize and unify warnings
2023-04-28 18:45:48 +02:00
Rémi Verschelde
0762f20410
Merge pull request #75732 from vonagam/fix-duplicate-condition
GDScript: Fix unnecessary duplication of pointed out lines
2023-04-28 18:45:25 +02:00
Rémi Verschelde
f374390fc1
Merge pull request #75014 from vonagam/assert-literal-false
GDScript: Allow usage of literal false in assert without a warning
2023-04-28 18:45:00 +02:00
Danil Alexeev
13310f3557
GDScript: Reorganize and unify warnings 2023-04-28 18:25:11 +03:00
Rémi Verschelde
7780926b25
GDScript: Fix template_debug compilation with TOOLS/DEBUG macro mismatch 2023-04-28 11:09:12 +02:00
George Marques
0ba6048ad3
Add support for static variables in GDScript
Which allows editable data associated with a particular class instead of
the instance. Scripts with static variables are kept in memory
indefinitely unless the `@static_unload` annotation is used or the
`static_unload()` method is called on the GDScript.

If the custom function `_static_init()` exists it will be called when
the class is loaded, after the static variables are set.
2023-04-27 09:51:44 -03:00
Rémi Verschelde
352ebe9725
Merge pull request #76483 from vnen/gdscript-dont-fail-returning-freed-object
GDScript: Don't fail when freed object is return
2023-04-27 08:47:04 +02:00
Rémi Verschelde
58439ac22c
Merge pull request #74053 from vnen/gdscript-fix-disassembler-lambda-crash
GDScript: Fix wrong increment for disassembly of lambda
2023-04-27 08:46:40 +02:00
Rémi Verschelde
35f6a1387c
Merge pull request #76488 from YuriSizov/docs-validate-code-params
Validate code tags in documentation for potential params
2023-04-27 08:20:42 +02:00
Rémi Verschelde
80568be36f
Merge pull request #76481 from vnen/gdscript-test-gen-default-path
GDScript: Use default path in test generator if not provided
2023-04-27 08:19:54 +02:00
Yuri Sizov
391eccca76 Validate code tags in documentation for potential params
Adds a check to make_rst to look for matches
between the text inside of the [code][/code] tag
and known param identifiers.
Fixes most of what was revealed.
2023-04-26 21:36:04 +02:00
Yuri Sizov
26fb911f79
Merge pull request #72095 from anvilfolk/gd-docs
Improve GDScript documentation generation & behavior
2023-04-26 16:54:25 +02:00
George Marques
221deb1cc1
GDScript: Use default path in test generator if not provided
Since it's almost always used with the same path, assume it is running
from the Godot source root.
2023-04-26 11:12:47 -03:00
George Marques
abbdf80643
GDScript: Don't fail when freed object is return
This is check is a bit too eager. The user should be able to handle the
return value even if it's a freed object.
2023-04-26 10:57:22 -03:00
Rémi Verschelde
45cd5dcad3
Merge pull request #75885 from AThousandShips/compound_fix
[GDScript] Fix incorrect compound assignment
2023-04-25 16:17:02 +02:00
Rémi Verschelde
a98997bb45
Merge pull request #76404 from sodaJar/gdrep
Fix wrong file name on function call error
2023-04-25 10:00:19 +02:00
Rémi Verschelde
15d952147c
Merge pull request #74101 from RandomShaper/fix_gds_obj_temps
Fix edge cases of object lifetime when signals involved
2023-04-25 09:58:17 +02:00
Rémi Verschelde
d45c6fd591
Merge pull request #76095 from adamscott/fix-rename-lsp-variables
[LSP] Fix GDScript inner method variable rename
2023-04-24 16:44:44 +02:00
Rémi Verschelde
54b0e8123e
Merge pull request #75605 from anvilfolk/type-base
Make GDScript type not found errors more informative.
2023-04-24 16:43:32 +02:00
sodaJar
464a299d2e Fix wrong file on function call error 2023-04-24 15:30:51 +02:00
Adam Scott
10fe6f14bb Fix GDScript LSP variable rename 2023-04-22 14:35:34 -04:00
ocean (they/them)
6783ff69c0 Improve and fix GDScript documentation generation & behavior
Removes documentation generation (docgen) from the GDScript compiler to
its own file. Adds support for GDScript enums and signal parameters and
quite a few other assorted fixes and improvements.
2023-04-21 10:17:30 -04:00
Rémi Verschelde
bf62af334b
Merge pull request #76286 from MystMagus/gdscript-mixed-tabs-and-spaces-fix
Fix for mixed tabs and spaces in gdscript
2023-04-20 18:08:47 +02:00
MistMage
fecbc12d17 Fix for mixed tabs and spaces in gdscript 2023-04-20 12:08:23 +02:00
Danil Alexeev
dbc3c82043
GDScript: Add some checks for @tool and @icon 2023-04-20 07:44:10 +03:00
Yuri Sizov
f3033da97d
Merge pull request #76170 from HolonProduction/string-highlight
Fix multi-line string highlighting with single quotes.
2023-04-18 18:01:02 +02:00
Yuri Sizov
9882af4880
Merge pull request #76197 from dalexeev/fix-error-macro-misuses
Fix misuses of error macros
2023-04-18 16:11:37 +02:00
Yuri Sizov
e31d391d56
Merge pull request #76090 from adamscott/fix-typo-lsp-parse-func-parameters
[LSP] Fix typo in parse function parameters
2023-04-18 15:57:08 +02:00
RedMser
2330ffb5a1 Add GDScript template to RichTextEffect 2023-04-18 14:02:04 +02:00
Danil Alexeev
36bedd341a
Fix misuses of error macros 2023-04-18 10:20:48 +03:00
Yuri Sizov
6596a6c1b5
Merge pull request #72979 from dalexeev/gds-annotation-parsing
GDScript: Fix and improve annotation parsing
2023-04-17 17:14:58 +02:00
Yuri Sizov
d220680bd0
Merge pull request #62830 from ajreckof/access-identifier-keywords
fix access to identifiers that are reserved keywords
2023-04-17 17:12:10 +02:00
HolonProduction
bdb7045e2c Fix multi-line string highlighting with single quotes. 2023-04-17 15:58:39 +02:00
Adam Scott
879791e305 Fix typo when parsing LSP function parameters 2023-04-15 09:05:53 -04:00
ajreckof
ab9f60dd1a fix access to identifiers that are reserved keywords 2023-04-14 20:37:24 +02:00
Danil Alexeev
5038a336be
GDScript: Fix and improve annotation parsing 2023-04-14 21:28:46 +03:00
Yuri Sizov
a7276f1ce0
Merge pull request #75691 from dalexeev/gds-fix-signature-generation
GDScript: Misc fixes and improvements for signature generation
2023-04-14 20:01:27 +02:00
Yuri Sizov
afca0b8fdd
Merge pull request #75879 from dalexeev/gds-fix-extends-crash
GDScript: Add missing member type check when resolving `extends`
2023-04-14 13:21:54 +02:00
Ninni Pipping
e5365da03c [GDScript] Fix incorrect compound assignment
Reverts in-place compound assignments

Added test to ensure correctness
2023-04-14 11:28:44 +02:00
Adam Scott
1236302388 Add missing script_type nullptr check
Co-authored-by: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
2023-04-11 12:36:28 -04:00
Pedro J. Estébanez
2f4168daeb Fix edge cases of object lifetime when signals involved 2023-04-11 17:27:39 +02:00
George Marques
59b8c70007 GDScript: Don't use pool for reference types
Since they need to be properly initialized and finalized to adjust the
reference counter.
2023-04-11 16:46:31 +02:00
Fabio Alessandrelli
4ab0b38940
Merge pull request #75850 from rsubtil/bugfix-lsp_dap_connection_poll
Poll LSP/DAP clients for connection status updates
2023-04-11 10:19:24 +02:00
Danil Alexeev
66279b98b6
GDScript: Add missing member type check when resolving extends 2023-04-10 17:16:07 +03:00
VolTer
f832eb92e4 Fix mistakes in documentation and GDScript errors 2023-04-10 10:00:09 +02:00
Ricardo Subtil
4be4eeea3a Poll LSP/DAP clients for connection status updates 2023-04-09 12:36:01 +01:00
Danil Alexeev
9df96e97ea
GDScript: Misc fixes and improvements for signature generation
* Use type hints for `@GlobalScope` enums.
* Use plain `int` for `BitMask<T>`.
* Fix type hints for typed arrays.
* Use `Variant` and `void` type hints.
* Discard unnecessary class prefix.
2023-04-07 10:43:21 +03:00
Dmitrii Maganov
5dc717c5fd GDScript: Fix unnecessary duplication of pointed out lines 2023-04-06 06:12:32 +03:00
ocean (they/them)
5d164df4e1 Make type not found errors more informative.
This PR removes a check for whether a datatype is a meta type when
generating a datatype's to_string() result. This means that error
messages that fail to find the type will now print their class names,
which is much more useful when trying to identify errors.
2023-04-02 18:30:30 -04:00
Araraura
e1c0df7048
Fix typo and slightly reword in @GDScript.xml
Fix "the every following property" to "then every following property" and change "is added" to "will be added".
2023-03-31 20:30:29 +00:00
Dmitrii Maganov
8655d979a1 GDScript: Allow elements of a parent class in a typed array literal 2023-03-28 13:47:24 +03:00
AleryBerry
0550f3682b GDScript: Fix error message for Lua-style dictionary 2023-03-20 21:45:06 +00:00
Yuri Sizov
a008a06fcb
Merge pull request #72056 from resistor/master
[GDScript] Perform update-and-assign operations in place when possible.
2023-03-20 19:16:30 +01:00
Yuri Sizov
215893ebca
Merge pull request #74949 from dalexeev/gds-fix-await-warning
GDScript: Fix false positive `REDUNDANT_AWAIT` warning
2023-03-20 19:14:15 +01:00
Yuri Sizov
5461b9976c
Merge pull request #74844 from vonagam/change-class-extends-parsing
GDScript: Change parser representation of class extends
2023-03-20 19:13:23 +01:00
Yuri Sizov
a5f34744a2
Merge pull request #74842 from vonagam/fix-builtin-shadow
GDScript: Fix missing warning for shadowing of built-in types
2023-03-20 19:10:13 +01:00
Hugo Locurcio
4e4555bea5
Improve Color8 documentation
This documents in which situations Color8 is most suited and its
precision limitations.
2023-03-19 17:42:15 +01:00
Dmitrii Maganov
5d0b183822 GDScript: Allow usage of literal false in assert without a warning 2023-03-17 05:37:56 +02:00
Danil Alexeev
c0eeb32e38
GDScript: Fix false positive REDUNDANT_AWAIT warning 2023-03-16 14:04:14 +03:00
Dmitrii Maganov
4e34cf238a GDScript: Change parser representation of class extends 2023-03-13 01:40:13 +02:00
Dmitrii Maganov
703274fd04 GDScript: Fix missing warning for shadowing of built-in types 2023-03-13 00:49:34 +02:00