Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor handling for @example with a JS decorator #224

Open
jfairley opened this issue Jan 12, 2024 · 0 comments
Open

Poor handling for @example with a JS decorator #224

jfairley opened this issue Jan 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jfairley
Copy link

jfairley commented Jan 12, 2024

The plugin splits up code examples that include a decorator. It seems the jsdoc parser interprets the @ as a jsdoc tag.

example 1

@example is removed entirely because the parser thinks there is no content

before

/**
 * Decorate my injectable service.
 * 
 * @example
 *   @Inject()
 *   private readonly someService: SomeService;
 * 
 * @example
 *   @Inject() private readonly someService: SomeService;
 */
export class SomeService {}

after

/**
 * Decorate my injectable service.
 *
 * @Inject() private readonly someService: SomeService;
 *
 * @Inject() private readonly someService: SomeService;
 */
export class SomeService {}

example 2

I added code comments to prove my hypothesis from example 1 (above).

You can see that the @Inject is extracted and moved down below the @example blocks.

before

/**
 * Decorate my injectable service.
 * 
 * @example
 *   // example 1
 *   @Inject()
 *   private readonly someService: SomeService;
 * 
 * @example
 *   // example 2
 *   @Inject() private readonly someService: SomeService;
 */
export class SomeService {}

after

/**
 * Decorate my injectable service.
 *
 * @example // example 1
 *
 * @example // example 2
 *
 * @Inject() private readonly someService: SomeService;
 *
 * @Inject() private readonly someService: SomeService;
 */
export class SomeService {}
@hosseinmd hosseinmd added the bug Something isn't working label Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants