Skip to content

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.

@magian1127 magian1127 force-pushed the 4.0tip branch 2 times, most recently from 0f384fd to a30d33a Compare September 17, 2025 07:36
@magian1127 magian1127 marked this pull request as ready for review September 17, 2025 07:42
@magian1127 magian1127 force-pushed the 4.0tip branch 7 times, most recently from 0716d5e to 2dc2681 Compare September 17, 2025 16:31
@magian1127
Copy link
Contributor Author

magian1127 commented Sep 17, 2025

I have updated the PR based on the latest code.
Additionally, Delsin-Yu has implemented better XML documentation for BBCode rendering.
Since the changes are quite extensive, we encourage interested parties to test it out.

image

@magian1127 magian1127 force-pushed the 4.0tip branch 2 times, most recently from 046ce78 to 9419521 Compare September 17, 2025 18:21
@Delsin-Yu
Copy link
Contributor

Delsin-Yu commented Sep 17, 2025

For quick reference, the following C# code:

using Godot;
using System;
using System.Diagnostics;

/// <summary>
/// Comment for <see cref="NewScript"/>.
/// </summary>
public partial class NewScript : Node
{
    /// <summary>
    /// Comment for <see cref="_integerField"/>.
    /// </summary>
    /// <remarks>
    /// Additional remarks for <see cref="_integerField"/>.
    /// </remarks>
    [Export] private int _integerField = 42;
    
    /// <summary>
    /// Comment for <see cref="_stringField"/>.
    /// </summary>
    /// <exception cref="UnreachableException">This exception is never thrown.</exception>
    [Export] private string _stringField = "Hello, World!";
    
    /// <summary>
    /// Comment for <see cref="CustomSignalEventHandler"/>.
    /// </summary>
    /// <param name="value">The integer value emitted with the signal.</param>
    /// <param name="message">The string message emitted with the signal.</param>
    /// <returns>Nothing.</returns>
    /// <exception cref="ArgumentOutOfRangeException">Thrown when the value is out of range.</exception>
    [Signal]
    private delegate void CustomSignalEventHandler(int value, string message);
}

will be compiled to the following documentation and tooltips.
image
image
image

@Delsin-Yu
Copy link
Contributor

Currently supported documentation blocks are:

  • summary
  • param
  • returns
  • exception
  • remarks

Within each documentation block, the following cases are supported:

  • <see cref="Type"/>
  • <code>Code</code>
  • <paramref name="message"/>
  • <typeparamref name="T"/>
  • <param name="value">Comment and supported cases</param>
  • <typeparam name="T">Comment and supported cases</typeparam>

@geekley
Copy link

geekley commented Sep 17, 2025

Question: does this implementation also support (currently or planned) disabling or overriding the tooltip if I want to have the XMLDoc different from the tooltip, via an attribute? (in this case it could even be BBCode if that's easier)
For example:

///<summary>Docs for both code and tooltip.</summary>
[Export] int health;

///<summary>Docs for code.</summary>
[Tooltip("""
Shows as [code]tooltip[/code].
""")]
[Export] int magic;

///<summary>Docs for code only.</summary>
[Tooltip("")] // no tooltip
[Export] int speed;

@Delsin-Yu
Copy link
Contributor

No currently, but a dedicated [Tooltip] attribute sounds like a decent addition as a future PR.

@magian1127 magian1127 changed the title C#: Implement tooltips for Signals and Properties in the inspector. C#: Documentation on supporting C# scripts in the Godot editor. Sep 19, 2025
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