Skip to content

Commit

Permalink
Fix inheritDoc across packages in packages mode
Browse files Browse the repository at this point in the history
Resolves #2331
  • Loading branch information
Gerrit0 committed Jul 9, 2023
1 parent 8fb9011 commit 833c875
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
### Bug Fixes

- Fixed duplicate definitions in type hierarchy when using packages mode, #2327.
- `@inheritDoc` was not properly resolved across packages in packages mode, #2331.

## v0.24.8 (2023-06-04)

Expand Down
19 changes: 14 additions & 5 deletions src/lib/converter/plugins/InheritDocPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Component, ConverterComponent } from "../components";
import { Converter } from "../converter";
import type { Context } from "../context";
import type { Reflection } from "../../models/reflections/abstract";
import { DefaultMap } from "../../utils";
import { BindOption, DefaultMap, ValidationOptions } from "../../utils";
import { zip } from "../../utils/array";
import { parseDeclarationReference } from "../comments/declarationReference";
import { resolveDeclarationReference } from "../comments/declarationReferenceResolver";
Expand All @@ -31,6 +31,9 @@ import { ApplicationEvents } from "../../application-events";
*/
@Component({ name: "inheritDoc" })
export class InheritDocPlugin extends ConverterComponent {
@BindOption("validation")
validation!: ValidationOptions;

// Key is depended on by Values
private dependencies = new DefaultMap<Reflection, Reflection[]>(() => []);

Expand All @@ -41,7 +44,11 @@ export class InheritDocPlugin extends ConverterComponent {
this.owner.on(Converter.EVENT_RESOLVE_END, (context: Context) =>
this.processInheritDoc(context.project)
);
this.owner.on(ApplicationEvents.REVIVE, this.processInheritDoc, this);
this.application.on(
ApplicationEvents.REVIVE,
this.processInheritDoc,
this
);
}

/**
Expand Down Expand Up @@ -90,9 +97,11 @@ export class InheritDocPlugin extends ConverterComponent {
}

if (!sourceRefl) {
this.application.logger.warn(
`Failed to find "${source}" to inherit the comment from in the comment for ${reflection.getFullName()}`
);
if (this.validation.invalidLink) {
this.application.logger.warn(
`Failed to find "${source}" to inherit the comment from in the comment for ${reflection.getFullName()}`
);
}
continue;
}

Expand Down

0 comments on commit 833c875

Please sign in to comment.