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

C#: Implement tooltips for Signals and Properties in the inspector. #83505

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

magian1127
Copy link
Contributor

@magian1127 magian1127 commented Oct 17, 2023

    /// <summary>
    /// tip text
    /// </summary>
    [Export]
    string s1 = "AAAA";

image
30N9OK8 7{39{)BWG@C(%RN
C D4LHV%8UP8 G)VKY_VUE

resolve godotengine/godot-proposals#8269

@geekley
Copy link

geekley commented Dec 30, 2023

Would it be possible to reuse this implementation for documentation of GDShader uniform fields? They are shown in the inspector, and it would be really useful for sharing shaders; e.g. on sites like https://godotshaders.com

@magian1127 magian1127 force-pushed the 4.0tip branch 2 times, most recently from 9c21641 to 943ddbc Compare January 4, 2024 07:24
@magian1127 magian1127 marked this pull request as draft March 24, 2024 06:18
@magian1127 magian1127 force-pushed the 4.0tip branch 3 times, most recently from 601893f to 4f4ee11 Compare March 24, 2024 07:58
@magian1127 magian1127 marked this pull request as ready for review March 24, 2024 07:59
@van800
Copy link
Contributor

van800 commented Mar 30, 2024

If this gets approved, it looks like worth setting
GenerateDocumentationFile in the Godot net sdk.

@mhilbrunner
Copy link
Member

mhilbrunner commented Apr 6, 2024

Removing the documentation label, as while this PR deals with documentation generation/display, this is more suited for the dotnet team to handle :)

@magian1127
Copy link
Contributor Author

Remove the need for GenerateDocumentationFile=true.

@mads-fs
Copy link

mads-fs commented Jun 9, 2024

I feel like this implementation would be better if the ExportAttribute was expanded with one extra optional field tooltip or description rather than using code comments to do it. While I see the flexibility in doing it this way it does feel cleaner in my opinion. Because the comments I leave in my code might make sense for a developer but not a designer and so I'd have to make my comments designer friendly every time I use the ExportAttribute.

Consider the following use-case:

Below I have some arbitrary code stub that uses the summary comment to decorate the field such that it would appear in the Godot editor. But I actually also need to annotate the code with a comment because of the TODO. This is not an uncommon use-case by any mean.

///<summary>
/// Change this string to set the state of the game.
///</summary>
// TODO: remember to expand parsing to include special characters
[Export] private string importantString

Now consider my suggestion:

// TODO: remember to expand parsing to include special characters
[Export(tooltip: "Change this string to set the state of the game.")]
private string importantString

To me it's a lot cleaner and it allows me to separate developer concerns from non-developer concerns.

@jwodicka
Copy link
Contributor

Also hoping to see this feature land - adding a note here since the last comment on this issue raises a potential objection to this design and proposes an alternative, but that alternative was discussed (and the implemented approach justified) in the related conversation at godotengine/godot-proposals#8269 . From the current state of that discussion, there seems to be broad agreement that a PR like this one could go forward.

Like many of the other commenters, I'm not in love with C#'s XML doc syntax, but interoperability with all my other tools that expect XML docs is a really big win. I think we'd gain a lot by starting there, and supporting the standard doesn't prevent us from allowing more Godot-like syntax for folks who want it in the future.

@magian1127
Copy link
Contributor Author

I updated the code, but I'm not sure why the PR was automatically closed, and I can't open it anymore.
https://github.com/magian1127/godot/tree/4.0tip

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

Successfully merging this pull request may close these issues.

Add support for generating class reference descriptions from C# documentation comments
7 participants