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

Work around Swift 5.6 modulename change #1288

Merged
merged 1 commit into from Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,7 +2,10 @@

##### Breaking

* None.
* When building with Swift 5.6 and not passing `—module` to Jazzy, declarations
may not be correctly identified as undocumented and docs may include unwanted
extensions. Pass `—-module MyModuleName` to fix this.
[John Fairhurst](https://github.com/johnfairh)

##### Enhancements

Expand Down
6 changes: 4 additions & 2 deletions lib/jazzy/source_declaration.rb
Expand Up @@ -183,10 +183,12 @@ def other_inherited_types?(unwanted)
inherited_types.any? { |t| !unwanted.include?(t) }
end

# SourceKit only sets modulename for imported modules
# Pre-Swift 5.6: SourceKit only sets modulename for imported modules
# Swift 5.6+: modulename is always set
def type_from_doc_module?
!type.extension? ||
(swift? && usr && modulename.nil?)
(swift? && usr &&
(modulename.nil? || modulename == Config.instance.module_name))
end

# Info text for contents page by collapsed item name
Expand Down
4 changes: 3 additions & 1 deletion lib/jazzy/sourcekitten.rb
Expand Up @@ -355,7 +355,9 @@ def self.should_document_swift_extension?(doc)
# Call things undocumented if they were compiled properly
# and came from our module.
def self.should_mark_undocumented(declaration)
declaration.usr && !declaration.modulename
declaration.usr &&
(declaration.modulename.nil? ||
declaration.modulename == Config.instance.module_name)
end

def self.process_undocumented_token(doc, declaration)
Expand Down