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

changed behavior of symbol.getDocumentationComment() #11956

Closed
sramam opened this issue Oct 31, 2016 · 4 comments
Closed

changed behavior of symbol.getDocumentationComment() #11956

sramam opened this issue Oct 31, 2016 · 4 comments
Labels
Fixed A PR has been merged for this issue

Comments

@sramam
Copy link

sramam commented Oct 31, 2016

I am interested in expanding the use of JsDoc comments to annotate interface fields with validation criteria. An attempt to use symbol.getDocumentationComment() seems to have different behavior
between 2.0 and 2.1 branches.

Sample doc comment (attached to an interface here, but I don't think that should matter)

export interface Foo {
/**
 * a description string
 *
 * @customTag foo
 * @customElse bar
 */
field: string;
};

The intent is to walk the tree of nodes and invoke getDocumentationComment on the symbol for 'field'

(<ts.Symbol>field).getDocumentationComment()

Expected behavior:

// version typescript@2.0.6

[ { text: 'a description string', kind: 'text' },
  { text: '\n', kind: 'lineBreak' },
  { text: '', kind: 'text' },
  { text: '\n', kind: 'lineBreak' },
  { text: '@customTag foo', kind: 'text' },
  { text: '\n', kind: 'lineBreak' },
  { text: '@customElse bar', kind: 'text' } ]

Actual behavior:

// version typescript@2.1.0-dev.20161031
[ { text: 'a description string', kind: 'text' }]

If this is intended behavior, please provide a way to get raw documentation so client applications and extend any default usage.

@minestarks
Copy link
Member

minestarks commented Dec 12, 2016

This change was introduced by #10671 and also broke UWP API documentation comments in VS 15. I'm working on a fix. And by fix I mean some way to get custom jsDoc tags from the language service, not necessarily reverting to the old behavior.

@sandersn
Copy link
Member

@sramam did the API that @minestarks added in #12856 address your request?

@sramam
Copy link
Author

sramam commented Apr 28, 2017

I haven't had a chance to look into this since. closing for now.

@sramam sramam closed this as completed Apr 28, 2017
@sramam
Copy link
Author

sramam commented May 7, 2017

I finally got around to looking into this, the API works perfectly. Thanks much @minestarks!

@RyanCavanaugh RyanCavanaugh added the Fixed A PR has been merged for this issue label May 8, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants