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

@param and @returns are overly sensitive to whitespace #1164

Closed
1 task done
ssokolow opened this issue Jan 12, 2020 · 2 comments
Closed
1 task done

@param and @returns are overly sensitive to whitespace #1164

ssokolow opened this issue Jan 12, 2020 · 2 comments
Labels
bug Functionality does not match expectation

Comments

@ssokolow
Copy link

Expected Behavior

@param and @returns should ignore up to two characters of leading whitespace between a * beginning a comment line and an @ beginning a javadoc annotation.

(Or, at the bare minimum, there should be a boldface warning in the docs and some kind of lint so such a subtle typo can't slip in unnoticed.)

Actual Behavior

When I tried to use @param and @returns to document function signatures in interface declarations, I kept getting them passing through as literals.

I wound up utterly convinced that there was a bug in the aspect of the parser which dealt with what subset of javadoc comments were supported and it was only while minimizing the testcase to report it here that I realized it wasn't actually a case of "@param and @returns are broken inside interface definitions" but rather the leading space I'd added so they visually lined up with the text on the /** line.

Steps to reproduce the bug

  1. Install TypeDoc on top of Using TypeScript 3.7.4 (what I got when I asked npm for the latest versions)
  2. Put the following in test.ts in an empty folder:
interface TestInterface {
  /** Function description
   *
   *  @param scope Test description.
   *  @returns Test description.
   */
  testFunc(scope: string): boolean;
}
  1. Run rm -rf docs; typedoc --out docs test.ts with the working directory set to the folder containing test.ts.

Backspacing away one character of whitespace before each @ will result in it working, but you have to know to do that and it's easy for it to slip back in if something like Vim is handling indentation and line-wrapping within comments.

Environment

  • Typedoc version: 0.16.1
  • Node.js version: v8.16.0
  • OS: Kbuntu 16.04.6 LTS
@ssokolow ssokolow added the bug Functionality does not match expectation label Jan 12, 2020
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 12, 2020

The @param and @returns should be properly picked up there. We shouldn't just ignore them. Thanks for the reproduction!

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 13, 2020

Fixed in 0.16.2 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants