omnisharp-roslyn icon indicating copy to clipboard operation
omnisharp-roslyn copied to clipboard

Inherited documentation (inheritdoc) is not used during signature help

Open NoTuxNoBux opened this issue 5 years ago • 3 comments

When using inheritdoc as per #1806, documentation is now correctly inherited, but the inherited documentation is not used in places such as signature help, only in tooltips.

Example code that reproduces this for me:

public interface IA
{
    /// <summary>
    /// This is foo in the interface!
    /// </summary>
    /// <param name="param">This is my param.</param>
    void foo(int param);
}

public class A : IA
{
    /// <inheritdoc/>
    public void foo(int param)
    {
        // Hovering on "foo" will show "This is foo in the interface!", but getting signature help in between
        // the parantheses will not show any documentation for "foo" nor for "param".
        this.foo();
    }
}

Demo Fail

If you make it explicit, it works as intended in both tooltips and signature help:

public interface IA
{
    /// <summary>
    /// This is foo in the interface!
    /// </summary>
    /// <param name="param">This is my param.</param>
    void foo(int param);
}

public class A : IA
{
    /// <summary>
    /// This is foo in the class!
    /// </summary>
    /// <param name="param">This is my param in the class.</param>
    public void foo(int param)
    {
        this.foo();
    }
}

Demo Works

Omitting inheritdoc entirely has the same problem as making it explicit.

NoTuxNoBux avatar Oct 22 '20 10:10 NoTuxNoBux

And cheating by doing this:

/// <inheritdoc cref="IA.foo"/>

...also doesn't work.

lonix1 avatar Feb 18 '21 17:02 lonix1

Another case that doesn't work is for extension methods.

You want to wrap some BCL function in an extension method, and reuse that function's docs:

/// <inheritdoc cref="Array.IndexOf{T}(T[], T)"/>
public static int IndexOf<T>(this T[] array, T value)
{
  return Array.IndexOf(array, value);
}

lonix1 avatar Sep 11 '21 05:09 lonix1

Would also love to be able to see docs from inheritdoc inside of a param (see example constructor docs below), but it doesn't work in VSCode.

  public class MyObject {
    /// <summary>Represents a value.</summary>
    public int MyValue { get; }

    /// <summary>
    /// Create an object with a value.
    /// </summary>
    /// <param name="myValue"><inheritdoc cref="MyValue" /></param>
    public MyObject(int myValue) => MyValue = myValue;
  }

Screen Shot 2022-05-10 at 5 56 00 PM

jolexxa avatar May 10 '22 22:05 jolexxa