docfx icon indicating copy to clipboard operation
docfx copied to clipboard

[Feature Request] Consolidate overloads

Open frarees opened this issue 1 year ago • 1 comments

Given this source:

namespace MyNamespace
{
    public class MyClass
    {
        public void MyMethod() { }
        public void MyMethod(float f) { }
        public void MyMethod(float f, int i) { }
        public void MyMethod<T>(float v, int i) { }
        public void MyMethod<T, T1>(float v, int i) { }
        public void MyMethod<T, T1, T2>(float v, int i) { }
        public int MyMethod(float v, int i, string s) => 0;
    }
}

MyNamespace.MyClass.html looks like this:

image

But I'd like to have an option to render it like this:

consolidated

Is this currently possible?

frarees avatar Jul 10 '24 10:07 frarees

I've managed to accomplish it at theme transformation level, via ManagedReference.extension.js (on top of modern).

Would be nice if all this would be leveraged by the builtin themes, and configurable through metadata.

One issue I've encountered is that I can't xref to a page - I don't know how. For example, if I have uid:MyNamespace.MyMethod(float, int), MyNamespace.MyMethod(float, float) but not uid:MyNamespace.MyMethod, I cannot consolidate into the xref MyNamespace.MyMethod. Instead, I have to avoid using xref/uid and store hrefs and names myself.

Is there any way to get a <xref> to point me to MyNamespace.MyMethod.html (no specific uid)? Otherwise I have to <a href="{{myCustomHref}}">.

Another issue is going to be which summary to use, when you have a bunch of overloads. Right now I pick the first one found.

If there's interest I can share my implementation.

frarees avatar Jul 16 '24 09:07 frarees