Skip to content

Commit

Permalink
Include classes from other packages in class hierarchy
Browse files Browse the repository at this point in the history
Resolves #2467
  • Loading branch information
Gerrit0 committed Nov 28, 2024
1 parent 5d279c3 commit fa2a322
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ title: Changelog

### Bug Fixes

- Include classes which inherit from another package in class hierarchy in packages mode, #2467.
- Fixed handling of `@categoryDescription` and `@groupDescription` on module pages, #2787.
- Fixed automatic discovery of entry points in packages mode.
- Reverted accidental style change for hierarchy page introduced in 0.27.0
- The hierarchy Expand/Collapse link will now only appear if the hierarchies are different.
- Fixed handling of `@categoryDescription` and `@groupDescription` on module pages, #2787.

## v0.27.0 (2024-11-27)

Expand Down
29 changes: 16 additions & 13 deletions src/lib/converter/plugins/TypePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ export class TypePlugin extends ConverterComponent {
this.onResolveEnd.bind(this),
);
this.owner.on(ConverterEvents.END, () => this.reflections.clear());
this.application.on(ApplicationEvents.REVIVE, this.onRevive.bind(this));
this.application.on(
ApplicationEvents.REVIVE,
this.onRevive.bind(this),
100,
);
}

private onRevive(project: ProjectReflection) {
for (const id in project.reflections) {
this.resolve(
project,
project.reflections[id],
/* create links */ false,
);
this.resolve(project, project.reflections[id]);
}
this.finishResolve(project);
this.reflections.clear();
Expand All @@ -45,11 +45,7 @@ export class TypePlugin extends ConverterComponent {
this.resolve(context.project, reflection);
}

private resolve(
project: ProjectReflection,
reflection: Reflection,
createLinks = true,
) {
private resolve(project: ProjectReflection, reflection: Reflection) {
if (!(reflection instanceof DeclarationReflection)) return;

if (reflection.kindOf(ReflectionKind.ClassOrInterface)) {
Expand All @@ -58,7 +54,12 @@ export class TypePlugin extends ConverterComponent {
walk(reflection.implementedTypes, (target) => {
this.postpone(target);
target.implementedBy ||= [];
if (createLinks) {

if (
!target.implementedBy.some(
(t) => t.reflection === reflection,
)
) {
target.implementedBy.push(
ReferenceType.createResolvedReference(
reflection.name,
Expand All @@ -73,7 +74,9 @@ export class TypePlugin extends ConverterComponent {
this.postpone(target);
target.extendedBy ||= [];

if (createLinks) {
if (
!target.extendedBy.some((t) => t.reflection === reflection)
) {
target.extendedBy.push(
ReferenceType.createResolvedReference(
reflection.name,
Expand Down

0 comments on commit fa2a322

Please sign in to comment.