Closed dfego closed 6 months ago
Do you also get these warnings in the editor? I'll look into it later today.
The original ones that caused me to report this, yes I originally saw those in the editor. The errors I mentioned seeing after those fixes I somehow didn't see in the editor. Since I thought the editor and code used the same language server, I do find that perplexing.
And you saw the warning when extending these specific classes?
Just checked it out and can't seem to get the Warnings in VSCode. Are you using any specific Linter or just the GDScript language server? I also can't reproduce the original warning message in the editor. How exactly did you get that?
Testing now, I'm:
And... not seeing the issue I saw. Normally I'd do the above before submitting anything at all, but it seemed like such a logical thing (the warning was valid) that I didn't. The error I get within my other project is:
W 0:00:03:0018 Function "_get_configuration_warnings()" has no static return type.
<GDScript Error>UNTYPED_DECLARATION
<GDScript Source>get_next_item_from_list_if_any.gd:18
And that's just on this, which is the default bit of code added by the script template:
# Add custom configuration warnings
# Note: Can be deleted if you don't want to define your own warnings.
func _get_configuration_warnings():
var warnings: Array = []
warnings.append_array(super._get_configuration_warnings())
# Add your own warnings to the array here
return warnings
I tried to make this easy by just creating a PR rather than submitting a ticket, but I'm not sure what's different in my project and this stripped down sample project that could cause this difference. The only plugins I have are format-on-save, and git (as well as yours).
In Project Settings -> Debug -> GDScript, I have everything turned on, including "Untyped Declaration".
Ah, I see. I am now getting those warnings too.
The common link here is that these are FSM ones, and the BT ones didn't give me any such issues, but I have no idea if that's relevant.
I figure, the problem is mostly because some of the FSM scripts do not have static return types, where as most BTs use -> PackedStringArray
. This is just an inconsistency on my part. I guess the linter uses the overridden method that has an untyped return declaration (equals -> Variant
) and starts screaming and kicking.
I cannot get any other warnings. Would you mind uploading a minimal project where you get these other warnings so I can see?
Not seeing those anymore, now that I've closed everything and gone back in fresh. Makes sense I guess, since the warnings weren't making sense anyway.
Not seeing those anymore, now that I've closed everything and gone back in fresh. Makes sense I guess, since the warnings weren't making sense anyway.
Yeah, I found the language server can be a bit of a mess sometimes. Especially when files haven't been loaded in a long time. If you don't have anything to add, I will merge this ASAP! Thank your for contributing <3
I was getting warnings in the editor with scripts derived from the script templates because they didn't specify a return type for the
_get_configuration_warnings()
function.That said, this has created four warnings that I cannot understand in VSCode's linting, however that works. So this is theoretically not ready for incorporation without further review.
The errors I'm seeing are all:
This makes no sense to me, because if I ctrl-click to the parent, it clearly shows
-> PackedStringArray
. I'm seeing this for the following files:fsm_state_integrated_bt.gd
fsm_state_integration_return.gd
new_state.gd
new_transition.gd
The common link here is that these are FSM ones, and the BT ones didn't give me any such issues, but I have no idea if that's relevant.
Also, I have the formatter installed, so various changes to whitespace are a result of that.