Skip to content

[SourceKit] restore __raw_doc_comment identifier #9868

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

Closed
wants to merge 1 commit into from
Closed

[SourceKit] restore __raw_doc_comment identifier #9868

wants to merge 1 commit into from

Conversation

keith
Copy link
Member

@keith keith commented May 23, 2017

This identifier can be used with sourcekit related tools to find doc
comments.

This reverts c78f169

Resolves SR-2487

This identifier can be used with sourcekit related tools to find doc
comments.
@keith
Copy link
Member Author

keith commented May 23, 2017

I'll need some more test fixture updates if it makes sense to move forward with this.

@CodaFi
Copy link
Contributor

CodaFi commented May 29, 2017

@bitjammer @akyrtzi Can anyone provide some background about why this was originally struck out as an "implementation detail"?

@akyrtzi
Copy link
Contributor

akyrtzi commented May 30, 2017

The presence of an __raw_doc_comment "attribute" is implementation detail of the AST.
If the intended functionality is to indicate that there's a doc comment attached to that entity then we should introduce a new field like key.has_doc_comment or even better provide the source range for the doc-comment like, key.doc_comment_offset and key.doc_comment_length.

To that end I'd prefer not to accept this PR as it currently stands.

@jpsim
Copy link
Contributor

jpsim commented May 30, 2017

or even better provide the source range for the doc-comment like, key.doc_comment_offset and key.doc_comment_length.

This would be amazing. That's been an idea I've had for a while, since the string and AST processing I resort to in SourceKitten to accomplish this are hacky and full of edge cases.

@CodaFi
Copy link
Contributor

CodaFi commented May 30, 2017

Alright. Given that I think I'll close this one for now.

@jpsim Do you have an idea of what needs to be changed here?

@CodaFi CodaFi closed this May 30, 2017
@jpsim
Copy link
Contributor

jpsim commented May 30, 2017

Nothing more than what @akyrtzi shared above.

Since SourceKit already extracts and processes doc comments (key.doc.full_as_xml), it would be a matter of looking at what that code does and extract just relevant bits to re-expose its offset and length.

@keith keith deleted the ks/raw-doc-comment branch June 3, 2017 02:39
@keith
Copy link
Member Author

keith commented Jun 3, 2017

What cases are full_as_xml present? It seems to me like that is not always the case, where it was with __raw_doc_comment

@jpsim
Copy link
Contributor

jpsim commented Jun 3, 2017

I think that's only available after indexing, unlike the old raw key. (SwiftLint doesn't use the index btw)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants