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

Add an Important annotation to prioritise options in code completion #8545

Closed
JUSTCAMH opened this issue Nov 30, 2023 · 3 comments
Closed

Add an Important annotation to prioritise options in code completion #8545

JUSTCAMH opened this issue Nov 30, 2023 · 3 comments

Comments

@JUSTCAMH
Copy link

Describe the project you are working on

Jam projects with godot

Describe the problem or limitation you are having in your project

I often want to use tools from the asset library (e.g. sound manager, scene manager). Such assets will typically provide an autoload which you can access in gdscript to interface with the various functions of the asset. The code completion for this though is poorly organised, with various node-specific functions at the top, and an impossibly long scroll list of functions, signals, variables and enums I don't care about. I would like to learn the functionality of the asset by browsing through it's functions, but these interesting functions are buried in amongst hundreds of other irrelevant options. Here's an example of the code completion for the SoundManager asset:

Code.Completion.mp4

Describe the feature / enhancement and how it helps to overcome the problem or limitation

This could be in the form of a new @ important annotation which places the function / variable above others in code completion. Asset creators could use this annotation to highlight important functions and variables. This annotation could also have an int order, however this could lead to inconsistent ordering between various assets. Having just an important or default level of priority is enough to separate important things from everything else in code complete. No options are added nor removed, only things marked with @ important are brought to the top of code completion.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

As described above. Adding the @ important annotation before any function, variable or anything else will result in that being sorted ahead of other options in code completion. Asset creators can use this to highlight the important functions, making it easier to learn what an asset can do.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

This enhances the experience of using assets, giving a way to see important functions separate from the hundreds of others.

@Calinou
Copy link
Member

Calinou commented Dec 1, 2023

To me, it sounds like we should fix/improve autocompletion rather than allowing specific add-ons to prioritize their completions. If add-ons prioritize their methods/properties without good justification, it won't improve the situation at all.

I would like to learn the functionality of the asset by browsing through it's functions,

You can use the Search Help button in top-right corner of the script editor. It displays classes registered by add-ons too 🙂

@HolonProduction
Copy link
Member

This is actually a bug with the autocompletion sorting. It is supposed to show methods defined in the autoload above options defined in the base type. The combination of godotengine/godot#85239 and godotengine/godot#85215 should fix the sorting problem.

@YuriSizov
Copy link
Contributor

Seems like the need for this solution comes from a bug rather than a limitation that needs a special feature to resolve. Please give 4.3 dev 3 a try later this month and see if it's working better/closer to what you expect. For now, let's close this as resolved.

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

No branches or pull requests

4 participants