Skip to content
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

Sort autocomplete results in the script editor by class hierarchy #99

Closed
ghost opened this issue Sep 24, 2019 · 4 comments · Fixed by godotengine/godot#58931 or godotengine/godot#59633

Comments

@ghost
Copy link

ghost commented Sep 24, 2019

Describe the project you are working on:
Autocomplete-heavy RPG

Describe how this feature / enhancement will help your project:
Autocomplete is great: you type in a few letters, find it in the list, hit enter, and all is well. However, frequently there's a lot of stuff that appears in autocomplete which effectively does little more than collect dust: a variety of constants, properties and functions that are, more often than not, completely irrelevant to what you're trying to do, and many of them go practically unused in a typical Godot game. Because of this, it's important to know ahead of time what it is you're looking for, to remember the name of the thing you're looking for, as otherwise you're typing any different thing you can think up that might be related to what it is you need.

If, instead, you were able to sort the autocomplete starting with the most immediate class, you would instantly be able to see exactly what's in that object you're looking in, very often being a script you've placed on a node, and just after that, the functionality of the node you've placed the script on, descending until you hit all the noise in the core classes (Object, Node, etc.), and if you really did want to look for something down at the bottom of the list, you could hit End on your keyboard to get there quickly. Now it's much clearer to find what it is you're looking for without needing to know the name of it, you can more easily browse an object's contents starting with what's likely to be most important: your script, and the node it sits on. It also makes things much easier when you're working with something new to see what each property, constant and function is associated with what class, allowing for faster learning.

Granted, one could always take a peek at the built-in docs if they wanted just what was in a particular class (excepting scripts, where instead you'd open up the script to see what was in it), but it's a little more out of the way, when all you want is a reminder of what you have to work with. In any case, as it stands, the ginormous list of everything that makes up an object isn't all that useful.

class_name Drop extends Resource

export var item: String = ""
export(float, 0.01, 1, 0.01) var chance := 0.5

image

Perhaps it can be toggled with a certain key combination. Also, perhaps PgDn and PgUp can be used to skip to the next class while this is active, to make it easier to skip to the class you're looking for.

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:

image

If this enhancement will not be used often, can it be worked around with a few lines of script?:
I think it will be used often, but if it wasn't, I assume it's not something that can be added easily.

Is there a reason why this should be core and not an add-on in the asset library?:
It changes how Godot works under the hood, doesn't add bloat, and wouldn't interfere with those who prefer the unsorted autocomplete, assuming it's toggleable.

@willnationsdev
Copy link
Contributor

Love the idea. I would just say that, rather than having titles/categories in the autocompletion list itself, I'd rather have the category over to the right, beside the identifier, as that helps condense the list. Would also be cool if a summary of the PropertyInfo/MethodInfo could also be beside it in the autocompletion dropdown.

@anissen
Copy link

anissen commented Sep 26, 2019

However, frequently there's a lot of stuff that appears in autocomplete which effectively does little more than collect dust: a variety of constants, properties and functions that are, more often than not, completely irrelevant to what you're trying to do, and many of them go practically unused in a typical Godot game.

Yes, a thousand times this!!

I'm a little apprehensive about sorting the auto-completion list other than lexicographically. I'm relatively new to Godot so I often scroll down to the get_...-methods to see what's available on a given object.

I think that much of the issues I have with the auto-completion could be solved by simply removing the enums and constants from the list. I actually tried to do this myself but couldn't figure it out.

I am also a bit confused as to why the enums are even in the list to begin with. I thought that from Godot 3.1 all enums would have to be prefixed with their type. Maybe the CONNECT_..., NOTIFICATION_..., etc. are simply constants and not enums?

Anyway, I'm all for anything that can make the auto-completion easier to use, especially for beginners.

@willnationsdev
Copy link
Contributor

willnationsdev commented Sep 26, 2019

@anissen

Maybe the CONNECT_... , NOTIFICATION_... , etc. are simply constants and not enums?

This is it. The basic scripting API has no enums. Only integer constants. Those constants are associated with classes from inside the engine. It is only user-defined enums that do not show their parts.

@YuriSizov YuriSizov changed the title Sort Autocomplete by Class Hierarchy Sort autocomplete results in the script editor by class hierarchy Apr 8, 2021
@EricEzaM
Copy link

EricEzaM commented Apr 8, 2021

Related: godotengine/godot#38449

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants