-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show auto-completion for user-defined methods when overriding in GDScript #5896
Comments
I have a working implementation of this, but it's blocked by a few issues:
|
Technically a duplicate of #393, but you have better mock-ups and even have an implementation, so I'll close my proposal. IMO we shouldn't show all methods for override, but there should be a way to explicitly mark them as virtual. Either by |
Personally, I think keywords/annotations can wait until we have actual virtual functions. Given how previous discussions weren't really going anywhere (and people couldn't really agree on the keyword), I wanted this proposal to just be a small QoL improvement that can be easily added to Godot. Because of that, showing all methods seem to be the most 'natural' behavior. As for |
Actually, maybe showing everything wouldn't be that bad. Built-in virtual methods always start with To me the most important part is that autocompleting a method automatically adds all necessary arguments. I use overriding a lot and it's a pain, because I always have to lookup the declarations and copy them. I wouldn't really mind the method list suddenly getting long. btw if you have implementation ready, you can open a PR even if it depends on something else. |
@KoBeWi I've been cleaning up the implementation a bit so I can raise a PR, but one main issue I'm stuck on is with default parameters. Since GDScript is allows any expression as default parameters, there are some edge cases where you can't really reduce the expression (like function calls). I've been using a modified For Example: This also applies for enums and arrays/dictionaries (possibly a bug). Because of this, I thought it might just be better to just copy over the exact default value expression? Given that child classes should share all members of their parents, expressions that are correct in parents should in theory also be correct in child classes. Any thought? |
Yeah there is no reason to reduce them. |
This would be super lovely to have, also perhaps options in GDScript project settings to warn / error when overriding a parent function incorrectly. |
This already exists. |
Ah, so it does, my mistake! It wasn't working earlier, but I had a compilation error elsewhere which was preventing the overriding error from showing! |
Describe the project you are working on
A 2D action game with a lot of interface-like classes
Describe the problem or limitation you are having in your project
Overriding user-defined methods are cumbersome as there are no auto-completion.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
In the script editor, show auto-completion for user-defined methods when declaring/overriding functions with the
func
keyword.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
In parent class:
In child class:
Specifics:
text_editor/completion/add_type_hints
is on).If this enhancement will not be used often, can it be worked around with a few lines of script?
This involves core GDScript.
Is there a reason why this should be core and not an add-on in the asset library?
This involves core GDScript.
The text was updated successfully, but these errors were encountered: