I am pretty new to Godot. There might have been a discussion about this somewhere.
When I am typing in “func _r” I get code completion for the ready() function. I hit Enter, or Tab and the editor fills in the rest. The whole “func _ready() → void:” which is great since typing in all the special characters is awkward on some keyboards.
This works great for built in functions. But there’s no code completion for my own custom functions? When I write “func my_func()” why not have code completion for " → void:"? Since this is the standard way for all functions, and if I want anything else I can still type that in.
I am sure that more experienced users have no problems filling this in pretty quickly. But as a new user I find that this QoL update would be much appreciated
I’d argue your assumption is wrong: → void: is not the standard for all functions.
By design many functions should actually return values. This might just be out of your current scope of design but you will eventually use that, I guess?
Also, GDscript still offers the low effort option of just defining a full function definition by leaving out any return value like this func my_func(): In that case, you could skip the whole return value declaration… but from a learning and getting better perspective: don’t be lazy
Sorry, not standard for all functions. I’m not new to programming or game development, just to Godot. But it is a common thing with custom functions to not return a value. So that’s why I think having code completion on that part is useful.
If anyone wants to type in anything different, it would not affect you at all. Code completion in the Godot editor only activates once you press enter or tab, otherwise you can just keep on typing in your own code.
I think I forgot that you can just skip the return value for void. The tutorial I’m watching right now types it in all the time. It is nice to have for consistency though. Coming from C#, I am used to typing in void.
I think it would be annoying and just cause me to have to delete and sometimes forget to delete → void. The only thing it does is to define what a function can return. I think it would create much more tedium than it would get rid of.
No, you would not have to delete anything. Because it only adds the void part if you hit enter or tab while typing. And as soon as you start adding anything that is not “-> void” it goes away. As soon as you add : it goes away, and you hit enter for a new line without any completion being added. It’s completely optional.
And this can also be added as an option to the editor settings. Under Text Editor > Completion.
Hm, maybe you are misunderstanding code completion in this particular event then: the editor is able to auto-complete func ready() → void: because it is actually overwriting the existing parental function. So if your class already had a parental function my__func() → void: it should actually auto-complete.
What you want is completion suggestions which is, if i am not mistaken, not actually a thing in Godot.
In Godot 7.2.1, when I start typing “func r” it opens up a list of suggestions and I can hit enter or tab and it fills in the rest. Or I can just keep on writing manually. So basically I would like the same thing with custom functions. Makes most sense that it appears after I close the brackets after the function. So I type “func my_func()” and then hit enter.