Skip to content

Commit

Permalink
Merge pull request #2693 from waynemwashuma/master
Browse files Browse the repository at this point in the history
Added support for `@abstract` tag
  • Loading branch information
Gerrit0 authored Sep 6, 2024
2 parents 0682459 + f4d7199 commit 15ba2dd
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Added `customJs` option to include a script tag in generated HTML output, #2650.
- Added `markdownLinkExternal` option to treat `http[s]://` links in markdown documents and comments as external to be opened in a new tab, #2679.
- Added `navigation.excludeReferences` option to prevent re-exports from appearing in the left hand navigation, #2685.
- Added support for the `@abstract` tag, #2692.

### Bug Fixes

Expand All @@ -17,6 +18,7 @@
### Thanks!

- @Aryakoste
- @waynemwashuma

## v0.26.6 (2024-08-18)

Expand Down
9 changes: 9 additions & 0 deletions src/lib/converter/plugins/CommentPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ export class CommentPlugin extends ConverterComponent {
comment.removeModifier("@interface");
}

if (comment.hasModifier("@abstract")) {
if (reflection.kindOf(ReflectionKind.SomeSignature)) {
reflection.parent!.setFlag(ReflectionFlag.Abstract);
} else {
reflection.setFlag(ReflectionFlag.Abstract);
}
comment.removeModifier("@abstract");
}

if (comment.hasModifier("@private")) {
reflection.setFlag(ReflectionFlag.Private);
if (reflection.kindOf(ReflectionKind.CallSignature)) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/utils/options/tsdoc-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const tsdocModifierTags = [

export const modifierTags = [
...tsdocModifierTags,
"@abstract",
"@class",
"@enum",
"@event",
Expand Down
14 changes: 14 additions & 0 deletions src/test/converter2/issues/gh2693.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export abstract class Foo {
abstract foo(): void;

abstract x: number;
}

/** @abstract */
export class Bar {
/** @abstract */
foo() {}

/** @abstract */
x!: number;
}
11 changes: 11 additions & 0 deletions src/test/issues.c2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,17 @@ describe("Issue Tests", () => {
equal(data2.comment, undefined);
});

it("#2693 handles the @abstract tag", () => {
const project = convert();
ok(query(project, "Foo.foo").flags.isAbstract);
ok(!querySig(project, "Foo.foo").flags.isAbstract);
ok(query(project, "Foo.x").flags.isAbstract);

ok(query(project, "Bar.foo").flags.isAbstract);
ok(!querySig(project, "Bar.foo").flags.isAbstract);
ok(query(project, "Bar.x").flags.isAbstract);
});

it("#2698 handles this parameters present in type but not node", () => {
const project = convert();
const animator = querySig(project, "animator");
Expand Down
4 changes: 4 additions & 0 deletions tsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
"tagName": "@class",
"syntaxKind": "modifier"
},
{
"tagName": "@abstract",
"syntaxKind": "modifier"
},
{
"tagName": "@document",
"syntaxKind": "block"
Expand Down

0 comments on commit 15ba2dd

Please sign in to comment.