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

Use a private TS api to get full comment text. #315

Merged
merged 1 commit into from
Jan 10, 2017
Merged

Conversation

rkirov
Copy link
Contributor

@rkirov rkirov commented Jan 10, 2017

In TS 2.1 the comment text is stripped of jsdoc @ annotations.
To read the full JSDoc text we temporary use a private API.

Passes all tests with 'TEST_FILTER=decorator gulp watch'

Closes #313

for (let d of decSym.getDeclarations()) {
// yuk, getLeadingCommentRangesOfNode is a private API, using it until
// https://github.com/Microsoft/TypeScript/issues/7393 is resolved.
// Switch to the TS JSDoc parser in the future to avoid false positives here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See getJSDoc() in tsickle.ts for another approach that doesn't use private API. It's about as long as what you wrote anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I didn't realize that some of the utilities.ts functions were exposed.

I decided against extracting into a comment tsickle helper to return JSDoc text, because it is just two calls into the TS apis and I hope we can switch to using the TS JSDoc parser eventually. WDYT?

In TS 2.1 the getDocumentationConent is stripped of jsdoc @ annotations.

Passes all tests with 'TEST_FILTER=decorator gulp watch'

Closes #313
@rkirov rkirov merged commit 37dc6ea into ts2.1 Jan 10, 2017
rkirov added a commit that referenced this pull request Jan 13, 2017
In TS 2.1 the getDocumentationConent is stripped of jsdoc @ annotations.

Passes all tests with 'TEST_FILTER=decorator gulp watch'

Closes #313
@thomaspink thomaspink mentioned this pull request Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants