-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Swiftify] Copy doc comment from clang node #81584
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
Conversation
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but I'm wondering whether it's easy to write a test to make sure that SourceKit picks up the comment attached to the macro-generated overload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. I do have a suggestion about tweaking the doc comment a little though
// to. Waiting until we know that the macro will be attached before | ||
// emitting the comment to the string, despite the comment occurring | ||
// first, avoids copying a bunch of potentially long comments for nodes | ||
// that don't end up with wrappers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to add a comment here that references an issue (or radar) about the fact that@param
and might need to be rewritten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a minor enough potential future QoL improvement that it doesn't warrant polluting the code with discussion around it
@swift-ci please smoke test |
It was actually easier than I thought! And I was able to verify that adding our custom line comment still is considered part of the same docs even if the rest uses block comments, which simplifies that implementation a lot. |
@swift-ci please smoke test |
Swift nodes imported from clang don't have doc comments carried over, but IDEs are clever enough to fetch the comments from the associated clang node. The swift node in the macro expansion from _SwiftifyImport doesn't have a clang node directly associated with it however. This patch adds the same comment from the clang node to the _SwiftifyImport macro invocation node. Since the macro has access to this node, it can easily copy over its leading trivia. For now the comment is not altered at all, meaning @param still remains even if the parmeter is removed. rdar://151346977
900eb32
to
a907481
Compare
@swift-ci please smoke test |
@swift-ci please smoke test windows |
test/SourceKit/CursorInfo/cursor_doc_comment_from_clang_safe_wrapper.swift
Show resolved
Hide resolved
@swift-ci please smoke test |
Swift nodes imported from clang don't have doc comments carried over, but IDEs are clever enough to fetch the comments from the associated clang node. The swift node in the macro expansion from _SwiftifyImport doesn't have a clang node directly associated with it however. This patch adds the same comment from the clang node to the _SwiftifyImport macro invocation node. Since the macro has access to this node, it can easily copy over its leading trivia. For now the comment is not altered at all, meaning @param still remains even if the parmeter is removed. rdar://151346977 (cherry picked from commit 6534b9b)
This reverts commit 6534b9b.
Swift nodes imported from clang don't have doc comments carried over, but IDEs are clever enough to fetch the comments from the associated clang node. The swift node in the macro expansion from _SwiftifyImport doesn't have a clang node directly associated with it however. This patch adds the same comment from the clang node to the _SwiftifyImport macro invocation node. Since the macro has access to this node, it can easily copy over its leading trivia. For now the comment is not altered at all, meaning @param still remains even if the parmeter is removed. rdar://151346977 (cherry picked from commit 6534b9b)
Swift nodes imported from clang don't have doc comments carried over, but IDEs are clever enough to fetch the comments from the associated clang node. The swift node in the macro expansion from _SwiftifyImport doesn't have a clang node directly associated with it however. This patch adds the same comment from the clang node to the _SwiftifyImport macro invocation node. Since the macro has access to this node, it can easily copy over its leading trivia. For now the comment is not altered at all, meaning @param still remains even if the parmeter is removed. rdar://151346977 (cherry picked from commit 6534b9b)
Swift nodes imported from clang don't have doc comments carried over, but IDEs are clever enough to fetch the comments from the associated clang node. The swift node in the macro expansion from _SwiftifyImport doesn't have a clang node directly associated with it however. This patch adds the same comment from the clang node to the _SwiftifyImport macro invocation node. Since the macro has access to this node, it can easily copy over its leading trivia. For now the comment is not altered at all, meaning @param still remains even if the parmeter is removed. rdar://151346977 (cherry picked from commit 6534b9b) (cherry picked from commit c9d51aa)
Swift nodes imported from clang don't have doc comments carried over, but IDEs are clever enough to fetch the comments from the associated clang node. The swift node in the macro expansion from _SwiftifyImport doesn't have a clang node directly associated with it however. This patch adds the same comment from the clang node to the _SwiftifyImport macro invocation node. Since the macro has access to this node, it can easily copy over its leading trivia. For now the comment is not altered at all, meaning @param still remains even if the parmeter is removed. rdar://151346977 (cherry picked from commit 6534b9b)
Swift nodes imported from clang don't have doc comments carried over, but IDEs are clever enough to fetch the comments from the associated clang node. The swift node in the macro expansion from _SwiftifyImport doesn't have a clang node directly associated with it however. This patch adds the same comment from the clang node to the _SwiftifyImport macro invocation node. Since the macro has access to this node, it can easily copy over its leading trivia. For now the comment is not altered at all, meaning @param still remains even if the parmeter is removed. rdar://151346977 (cherry picked from commit 6534b9b)
[Swiftify] Copy doc comment from clang node (#81584)
Swift nodes imported from clang don't have doc comments carried over, but IDEs are clever enough to fetch the comments from the associated clang node. The swift node in the macro expansion from _SwiftifyImport doesn't have a clang node directly associated with it however.
This patch adds the same comment from the clang node to the _SwiftifyImport macro invocation node. Since the macro has access to this node, it can easily copy over its leading trivia.
For now the comment is not altered at all, meaning @param still remains even if the parmeter is removed.
rdar://151346977