Commit Graph

942 Commits

Author SHA1 Message Date
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
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
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
bcbe5b5850 Fixed leak in gdscript when creating empty WeakRef
Fixes #33150
2019-10-29 23:53:56 +01:00
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
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
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
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
fddc60c85c Merge pull request #32878 from EbbDrop/no_autocompletion_for_singeltons
Fixes auto completion for singletons
2019-10-22 13:50:25 +02:00
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
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
5b96233c34 Remove duplicate valid value check in gdscript_tokenizer.cpp. 2019-10-18 11:58:34 +02:00
f70fd781fc Fix autocompletion for singletons 2019-10-17 10:48:13 +02:00
616ab4fac2 Small fixes to redundand code, copy paste bugs 2019-10-14 11:40:55 +02:00
d9dfc4496c fix #32588 crash in language server 2019-10-11 14:43:39 +02:00
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
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
1ab34bc3c2 lsp: Send godot class tree to clients 2019-10-09 13:40:50 +08:00
2b5b5874a2 lsp: Fix signature of void returned functions in native methods 2019-10-09 10:01:48 +08:00
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
9f27a4838c Format documentations to markdown only when needed 2019-10-05 14:09:38 +08:00
e199488bc7 Add custom api textDocument/nativeSymbol to allow inspect native symbols from LSP clients 2019-10-04 23:00:33 +08:00
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
d66cce0215 Merge pull request #32517 from GodotExplorer/gdscript-lsp
GDScript LSP server improvement
2019-10-03 13:40:09 +02:00
6a8303f82f Implement DocumentLink of GDScript LSP Server 2019-10-03 18:51:03 +08:00
c9781df316 Merge pull request #32403 from yeonghoey/enforce4space
Print errors when tab indent found in [codeblock]
2019-10-03 08:41:21 +02:00
d1a6964d39 Fix codeblock formating to markdown 2019-10-03 14:22:26 +08:00
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
d4a55fb639 Print errors when tab indent found in [codeblock] 2019-10-01 23:39:45 +09:00
d66d970fdb Merge pull request #32172 from WindyDarian/gdscript_allow_null_weakref
Allow weakref(null) in gdscript
2019-10-01 10:35:37 +02:00
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
dec10dd776 Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
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
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
c1fcb22677 Fix line being assigned to twice in the GDScript language server
This closes #32090.
2019-09-23 15:27:30 +02:00
50be65bf43 Changed some code found by Clang Tidy and Coverity 2019-09-22 18:45:08 +02:00
25a1bfed5c Merge pull request #32210 from Calinou/editor-log-distinguish-messages
Distinguish editor-originating messages in the editor log
2019-09-20 20:22:43 +02:00
fdc2463a1b Merge pull request #32150 from luzpaz/typos
Fix misc. source comment typos
2019-09-20 17:09:05 +02:00
ba566dff2e Distinguish editor-originating messages in the editor log
This fades out messages originating from the editor to make messages
printed by the project stand out more.

This also tweaks wording in some editor messages for consistency.
2019-09-20 01:59:02 +02:00
91ecd7b6a6 Fix misc. source comment typos
Found using `codespell -q 3 -S ./thirdparty,*.po -L ang,ba,cas,dof,doubleclick,fave,hist,leapyear,lod,nd,numer,ois,paket,seeked,sinc,switchs,te,uint -D ~/Projects/codespell/codespell_lib/data/dictionary.txt `
2019-09-19 14:36:52 -04:00
c3d5c96494 Merge pull request #31921 from bojidar-bg/28978-uninitialized-array-value
Fix uninitialized arrays and dictionaries retaining value
2019-09-19 20:31:12 +02:00
291f408fcf Merge pull request #32100 from SaracenOne/gdscript_parent_const_types
Fix const deceleration for inherited scripts above immediate parent
2019-09-19 20:11:37 +02:00
b5f14cc6f7 Merge pull request #31934 from mitchcurtis/28187
Produce an error when a class has the same name as a Singleton
2019-09-19 20:05:41 +02:00
318ac6ee13 Merge pull request #31142 from mitchcurtis/assert-message
GDScript: add an optional message parameter to assert()
2019-09-19 19:56:05 +02:00
628f467605 Allow weakref(null) in gdscript
Tiny addition I personally found useful - this allows us to `var my_ref := weakref(null)` for nullable weak ref (with type hint!). When trying to test if `my_ref` is holding valid reference, we can just `if my_ref.get_ref():` instead of `if my_ref and my_ref.get_ref():` everywhere.
2019-09-16 23:15:34 -04:00
aa8e3e7b0f GDScript: add an optional message parameter to assert()
Before this patch, assert() only took the condition to assert on:

    assert(item_data)

Now, it can optionally take a string that will be printed upon failure:

    assert(item_data, item_name + " has no item data in ItemDatabase")

This makes it easier to immediately see what the issue is by being
able to write informative failure messages.

Thanks to @wiped1 for sharing their patch, upon which this is based.

Closes #17082
2019-09-11 15:37:11 +02:00
cf00f35a8e Allow for constant deceleration to be detected inherited scripts above the immediate parent. 2019-09-11 06:19:20 +01:00
8f5ffeeacc Produce an error when a class has the same name as a Singleton
If you somehow end up with a Singleton.gd that looks like this:

	extends Node

	class_name Singleton

	func foo():
	    pass

You will get an error when using it in another file:

	extends Node2D

	func _init():
	    # Parser Error: Non-static function "foo" can only be called from an instance.
	    Singleton.foo()

This error is confusing. This patch ensures that an error on the class_name line will be produced:

    Parse Error: The class "Singleton" conflicts with the AutoLoad singleton of the same name, and is therefore redundant. Remove the class_name declaration to fix this error.

Fixes #28187.
2019-09-06 17:12:43 +02:00
617797c47c Adds skip-breakpoints feature 2019-09-03 20:49:09 +02:00