Skip to content

[Repo Assist] Show inherited members from documented base types on type pages#1039

Merged
dsyme merged 10 commits intomainfrom
repo-assist/fix-issue-590-inherited-members-a9e5a485bc826870
Feb 27, 2026
Merged

[Repo Assist] Show inherited members from documented base types on type pages#1039
dsyme merged 10 commits intomainfrom
repo-assist/fix-issue-590-inherited-members-a9e5a485bc826870

Conversation

@github-actions
Copy link
Contributor

🤖 This is an automated PR from Repo Assist.

Closes #590

Summary

Implements MSDN-style "Inherited members" sections on API documentation type pages.

When a type inherits from a base class that is also part of the same documentation set (i.e., registered in the same fsdocs run), its instance and static members are now shown below the type's own members, grouped under a heading like:

Inherited from BaseClass

Members from external base types (e.g. System.Object) are intentionally excluded to keep pages uncluttered.

Root Cause

The getMembers helper in SymbolReader.readType already walked the base type chain, but only folded in members from excluded/omitted bases. Members from visible (non-excluded) base types were silently dropped.

Changes

File Change
CrossReferenceResolver.fs Add TryResolveUrlBaseNameForEntity to check if a type is registered
ApiDocTypes.fs Add inheritedMembers constructor param and InheritedMembers property to ApiDocEntity
SymbolReader.fs Add getInheritedMemberGroups that walks the base-type chain collecting members from registered bases
GenerateHtml.fs Render "Inherited members" → "Inherited from X" sections after own members
GenerateMarkdown.fs Same for Markdown output
RELEASE_NOTES.md Changelog entry

Behaviour

  • Only members from base types registered in the same docs set are shown (no System.Object noise).
  • Excluded/omitted bases are still folded into the type's own member list (existing behaviour preserved).
  • Constructors of base types are excluded (they can't be called as inherited).
  • Override/explicit interface members are excluded.
  • Obsolete members in inherited groups are filtered out.
  • The base type name is rendered as a link (using the existing formatTypeAsHtml / URL-map machinery).

Test Status

415/415 tests pass (dotnet test FSharp.Formatting.sln --configuration Release). Build is clean with 0 errors.

Trade-offs / Notes

  • This is a non-breaking additive change — the new InheritedMembers property is appended as the last constructor parameter; callers that don't construct ApiDocEntity directly are unaffected.
  • A future improvement could add a per-type [(fsdocs: no-inherited-members)] opt-out annotation if needed.

Generated by Repo Assist for issue #590

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@afb00b92a9514fee9a14c583f059a03d05738f70

Add MSDN-style 'Inherited members' section to API doc type pages.
Members from base types that are registered in the same docs set are
collected and rendered grouped by declaring base type (with a link),
below the type's own members.

- CrossReferenceResolver: add TryResolveUrlBaseNameForEntity
- ApiDocEntity: add InheritedMembers property
- SymbolReader.readType: collect getInheritedMemberGroups, walking the
  base-type chain and stopping at excluded/omitted or external bases
- GenerateHtml/GenerateMarkdown: render 'Inherited from X' sections

415/415 tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review February 26, 2026 19:08
@nojaf
Copy link
Collaborator

nojaf commented Feb 27, 2026

/repo-assist refactor code to adhere to analyze feedback

Replace the two-step List.map/List.filter pipeline with List.choose
in GenerateHtml.fs and GenerateMarkdown.fs to address
CombinePipedModuleFunctionsAnalyzer warnings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: 938c0fe

Generated by Repo Assist

@github-actions

This comment has been minimized.

@dsyme
Copy link
Contributor

dsyme commented Feb 27, 2026

/repo-assist We need tests added, and could you generate HTML and markdown for a small example please, pasting the markdown in a reply here also update the docs and make it possible to opt out through a project setting

Copy link
Contributor

@dsyme dsyme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment

- Add BaseClassForInheritance and DerivedClassForInheritance to FsLib2 test library
- Add model test: InheritedMembers is populated for derived types
- Add output tests: HTML and Markdown render 'Inherited from' sections
- Update type count assertion from 11 to 13 for the two new types

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: 089f648

Generated by Repo Assist

@github-actions

This comment has been minimized.

- Add ShowInheritedMembers field to ApiDocInput (default true)
- Thread through ReadingContext and readAssembly
- Gate getInheritedMemberGroups on ctx.ShowInheritedMembers
- Add FsDocsNoInheritedMembers MSBuild property to ProjectCracker
- Wire through BuildCommand tuple (11-element)
- Add two test cases: model-level and output-level opt-out
- Update docs/commandline.md with new project setting
- Update RELEASE_NOTES.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: 0f8e703

Generated by Repo Assist

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

Done! Here's what I added in the latest push:


Changes

1. Tests (2 new)

ApiDocs ShowInheritedMembers false suppresses InheritedMembers on model — verifies derivedEntity.Value.InheritedMembers.IsEmpty = true when ShowInheritedMembers = false is set on ApiDocInput.

ApiDocs ShowInheritedMembers false suppresses inherited section in output — verifies the generated file does not contain "Inherited from" or "BaseMethod" when the flag is off.

All 76 existing tests continue to pass.


2. Opt-out via project setting

Add to your .fsproj:

(FsDocsNoInheritedMembers)true(/FsDocsNoInheritedMembers)

This sets ShowInheritedMembers = false on the ApiDocInput for that project, which causes getInheritedMemberGroups to return [] without walking the base-type chain.

The ApiDocInput.FromFile static helper also now accepts an optional ?showInheritedMembers parameter for programmatic use.


3. Docs updated

docs/commandline.md now has a "Controlling inherited-member display" section explaining the opt-out.


4. Sample markdown output

Here is the generated Markdown for DerivedClassForInheritance (from the test run):

## DerivedClassForInheritance Type

Namespace: [FsLib](/reference/fslib)

Assembly: FsLib2.dll

Base Type: `BaseClassForInheritance`

Derived class that inherits documented members from BaseClassForInheritance (issue #590)

### Constructors

#### `DerivedClassForInheritance()`

Returns: `DerivedClassForInheritance`

### Instance members

#### `this.DerivedMethod`

A method on the derived class

Returns: `int`

### Inherited members

#### Inherited from `BaseClassForInheritance`

### Instance members

#### `this.BaseMethod`

A documented instance method on the base class

Returns: `int`

### Static members

#### `BaseClassForInheritance.BaseStaticMethod()`

A documented static method on the base class

Returns: `string`

And the corresponding HTML fragment (simplified):

<h3>Inherited members</h3>
<h4>Inherited from <code>(a href="https://github.com/reference/fslib-baseclassforinheritance.html")BaseClassForInheritance(/a)</code></h4>
<h3>Instance members</h3>
<table class="table outer-list fsdocs-member-list">
  
  <tr>
    <td class="fsdocs-member-usage"><code>this.BaseMethod</code></td>
    <td class="fsdocs-member-xmldoc">A documented instance method on the base class</td>
  </tr>
</table>
<h3>Static members</h3>
<table class="table outer-list fsdocs-member-list">
  
  <tr>
    <td class="fsdocs-member-usage"><code>BaseClassForInheritance.BaseStaticMethod()</code></td>
    <td class="fsdocs-member-xmldoc">A documented static method on the base class</td>
  </tr>
</table>

Generated by Repo Assist for issue #1039

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@afb00b92a9514fee9a14c583f059a03d05738f70

@dsyme dsyme merged commit a0327b2 into main Feb 27, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/fix-issue-590-inherited-members-a9e5a485bc826870 branch February 27, 2026 11:45
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.

Show inherited members

2 participants