-
-
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
Highlight autocompletion suggestions from the direct class (as opposed to inherited classes) #4339
Comments
Styling: using a bold font would mean adding the bold version of Jetbrains Mono to the editor fonts, which includes quite a bit of boilerplate. Probably not worth it - might be better to just stick to a slightly accented color. Implementation: Using the new "location" property added in godotengine/godot#58931, it is possible to do this styling. However there is one hiccup: using the parent mask is not so trivial unfortunately. Due to the way the GDScript language code completion code works, the location value which has the "parent [class] mask" applied includes the "recursion depth", which is used to track the recursion depth of the functions that recursively collect all the identifiers from classes and their parents. (see The problem: This recursion depths is not strictly one-per class. In a test I did, a property in the file I was using had a location of 257 ( Once that is sorted, I just had to add this code to the code edit draw code (plus some other stuff just to pass the location to the code edit): if (code_completion_options[l].location == ScriptLanguage::LOCATION_LOCAL ||
(code_completion_options[l].location & ~ScriptLanguage::LOCATION_PARENT_MASK) == 0) {
// Draw text line in different color
} else {
// Draw text line in normal color
} Note in the image below, |
|
I do like that accented colour, actually. I don't think it fits for direct classes, though. If it can be done, I wonder if the colour could symbolise something else entirely... |
I also recommend to display direct classes with a precedence above inherited classes. |
That is already the case in 4.0 |
I think it would be great to be able to show/hide parameters from each class on button clicks so that autocomplete isn't cluttered with a bunch of parameters |
Related to #4189.
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
The script editor's autocompletion dialog currently doesn't distinguish between suggestions provided by the direct class and inherited classes.
For example, if you're extending MeshInstance3D, autocompletion suggestions coming from MeshInstance3D properties and methods will look identical to those coming from Node3D.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Highlight autocompletion suggestions from the direct class (as opposed to inherited classes). This could be writing them in bold, using a different color (such as a partial blend of the editor accent color), or something else.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
@EricEzaM posted an example from Rider in #4189 (comment):
If this enhancement will not be used often, can it be worked around with a few lines of script?
No, as the script editor's code completion dialog is not extensible with add-ons.
Is there a reason why this should be core and not an add-on in the asset library?
See above.
The text was updated successfully, but these errors were encountered: