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

GDNative: View custom docs from the editor. #2028

Closed
LennyPhoenix opened this issue Dec 26, 2020 · 5 comments
Closed

GDNative: View custom docs from the editor. #2028

LennyPhoenix opened this issue Dec 26, 2020 · 5 comments

Comments

@LennyPhoenix
Copy link

Describe the project you are working on

A Discord Game SDK wrapper for Godot, written in C using nativescript.

Describe the problem or limitation you are having in your project

Although, nativescript 1.1 gives us the ability to set class, method, signal and property documentation via nativescript_1_1_api->godot_nativescript_set_X_documentation, there is no way to view these docs other than calling CLASSNAME.get_X_documentation() in GDScript.

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

Allow the built-in script editor to display these custom-defined docs.

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

Here is a mockup using the GDNative example from the docs

Docs definition from C:

    godot_string string;

    api->godot_string_new(&string);
    api->godot_string_parse_utf8(&string, "<My class docs>");
    nativescript_1_1_api->godot_nativescript_set_class_documentation(p_handle, "Simple", string);
    api->godot_string_destroy(&string);

    api->godot_string_new(&string);
    api->godot_string_parse_utf8(&string, "<My method docs>");
    nativescript_1_1_api->godot_nativescript_set_method_documentation(p_handle, "Simple", "get_data", string);
    api->godot_string_destroy(&string);

Mockup of the docs in the editor: (Made in GIMP)
mockup

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

Not that I know of.

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

There is no way the add-on can interact with this as far as I know, that is the point of this proposal.

@jonbonazza
Copy link

I think a better proposal would be a way of creating and displaying custom.documentation in general, regardless of the specific scripting language.

@LennyPhoenix
Copy link
Author

@jonbonazza I agree, I thought GDNative needs it more specifically as you can't just look at the source code (and therefore function prototypes) of a compiled library, making it harder to tell what everything does without external documentation. Maybe for GDScript, docstrings could be displayed for the class's documentation, I'm not sure about VisualScript or Mono/C# though

@Calinou
Copy link
Member

Calinou commented Dec 27, 2020

I think a better proposal would be a way of creating and displaying custom.documentation in general, regardless of the specific scripting language.

In the master branch, this is already supported in GDScript: godotengine/godot#41095

GDNative will need a specific implementation of this feature.

@jonbonazza
Copy link

Hmm seems like the gdscript implentation in that pr is specific to gdscript. Bummer. I was hoping there could be some language agnostic mechanism to support this feature.

Oh well, if that's the case then yea, i guess this proposal makes sense being gdnative-specific.

@aaronfranke
Copy link
Member

Thank you for this proposal! I'm closing this as a duplicate, in favor of proposal #8245.

@aaronfranke aaronfranke closed this as not planned Won't fix, can't repro, duplicate, stale Apr 21, 2024
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