script-ide icon indicating copy to clipboard operation
script-ide copied to clipboard

Override Popup to quickly override superclass functions

Open Maran23 opened this issue 10 months ago • 9 comments

This is the implementation of my idea in https://github.com/Maran23/script-ide/pull/98. With ALT+INSERT, you can now open the override dialog which will then show you all functions that can be overridden. Everything needed is only performed when the shortcut is pressed, so this will not slow down the main plugin at all.

image

Supersedes: https://github.com/Maran23/script-ide/pull/98 @CodeNameTwister, you may want to check it out!

Maran23 avatar Mar 29 '25 21:03 Maran23

Well i finish too 🤣

image

I'll see the pull now

EDIT: I've updated my fork.

You can test the functionality by right-clicking (RMB) in the script editor or RMB in scripts selector. I've attached an image.

image

CodeNameTwister avatar Mar 29 '25 23:03 CodeNameTwister

From what I've been reviewing, our idea is the same.

The difference is that your code allows overriding all functions, while mine is limited to virtual functions only.

There will be people who like to see all the methods so it's worth it.

image

Check out my fork, in case you find anything interesting.

Mine only captures virtual functions.

https://github.com/CodeNameTwister/script-ide

CodeNameTwister avatar Mar 30 '25 00:03 CodeNameTwister

I like your approach with showing all native functions as well. I will have a look on this one too! I feel like we are going in a nice direction! :)

Maran23 avatar Mar 30 '25 00:03 Maran23

You guys are onto something here - I actually use this branch instead of master, because Godot won't auto-complete overriding methods. So there's dire need for this functionality.

It's good and functional the way it's implemented now, quick selection works acceptable, even though I'd prefer it to work similar to the outline where text input would filter the list of overridable methods, and you get to choose the target method with the arrow keys + enter. I understand the benefit of the current approach is to override multiple methods at once, but the filter+arrow+enter approach would be so much faster. I would go so far to suggest dropping the multi-selection in favor of a fast single-selection. but maybe it's even possible to allow multi-selection in the filtered-method-list ui element?

mrimvo avatar Apr 11 '25 07:04 mrimvo

You guys are onto something here - I actually use this branch instead of master, because Godot won't auto-complete overriding methods. So there's dire need for this functionality.

It's good and functional the way it's implemented now, quick selection works acceptable, even though I'd prefer it to work similar to the outline where text input would filter the list of overridable methods, and you get to choose the target method with the arrow keys + enter. I understand the benefit of the current approach is to override multiple methods at once, but the filter+arrow+enter approach would be so much faster. I would go so far to suggest dropping the multi-selection in favor of a fast single-selection. but maybe it's even possible to allow multi-selection in the filtered-method-list ui element?

I refined the override functionality tool, there are many ways to override settings depending on who inherits, so manual selection is preferable.

Let me know if you need any changes. I'll continue updating my GitHub content for another two weeks before focusing entirely on my main project.

Repository: https://github.com/CodeNameTwister/GD-Override-Functions

CodeNameTwister avatar Apr 11 '25 07:04 CodeNameTwister

It's good and functional the way it's implemented now, quick selection works acceptable, even though I'd prefer it to work similar to the outline where text input would filter the list of overridable methods, and you get to choose the target method with the arrow keys + enter. I understand the benefit of the current approach is to override multiple methods at once, but the filter+arrow+enter approach would be so much faster. I would go so far to suggest dropping the multi-selection in favor of a fast single-selection. but maybe it's even possible to allow multi-selection in the filtered-method-list ui element?

Thanks for the feedback! I will have a look, it should be possible to implement a filter! And if we add all native classes as well, we probably need it anyway.

Maran23 avatar Apr 11 '25 08:04 Maran23

Thank you guys for your amazing work! @CodeNameTwister going to check out your version later today :+1:

Another feedback: I noticed the override would be inserted at the end of the file. Would be cool if it was inserted at the cursor position, given it's a blank line.

mrimvo avatar Apr 11 '25 10:04 mrimvo

Another feedback: I noticed the override would be inserted at the end of the file. Would be cool if it was inserted at the cursor position, given it's a blank line.

Makes sense, other IDEs do the same. We just need to be careful to not override user content of course.

Maran23 avatar Apr 11 '25 12:04 Maran23

@mrimvo Feel free to retest! Now with a filter. Keyboard navigation is very bad and not really to implement on the Tree right now. I hate this Control because of it. I think I might go with multiple ItemList instead, that you can expand/collapse. But that is more work, so I think this is good enough for now. :)

Maran23 avatar Apr 11 '25 17:04 Maran23