diff --git a/CHANGELOG.md b/CHANGELOG.md index ea53f55dd..c5d216ad4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,9 @@ ##### Bug Fixes -* None. +* No longer count initializers with parameters as undocumented. + [JP Simard](https://github.com/jpsim) + [#183](https://github.com/realm/jazzy/issues/183) ## 0.1.2 diff --git a/lib/jazzy/source_declaration/type.rb b/lib/jazzy/source_declaration/type.rb index bb8abfe93..f0ad7c680 100644 --- a/lib/jazzy/source_declaration/type.rb +++ b/lib/jazzy/source_declaration/type.rb @@ -31,10 +31,21 @@ def mark? kind == 'source.lang.swift.syntaxtype.comment.mark' end + def should_document? + declaration? && !param? + end + def declaration? kind =~ /^source\.lang\.swift\.decl\..*/ end + def param? + # SourceKit strangely categorizes initializer parameters as local + # variables, so both kinds represent a parameter in jazzy. + kind == 'source.lang.swift.decl.var.parameter' || + kind == 'source.lang.swift.decl.var.local' + end + def self.overview Type.new('Overview') end diff --git a/lib/jazzy/sourcekitten.rb b/lib/jazzy/sourcekitten.rb index abdf08785..16b479ab5 100644 --- a/lib/jazzy/sourcekitten.rb +++ b/lib/jazzy/sourcekitten.rb @@ -143,7 +143,7 @@ def self.make_source_declarations(docs) if declaration.type.mark? && doc['key.name'].start_with?('MARK: ') current_mark = SourceMark.new(doc['key.name']) end - next unless declaration.type.declaration? + next unless declaration.type.should_document? unless declaration.type.name raise 'Please file an issue on ' \ diff --git a/spec/integration_specs b/spec/integration_specs index 579f9c717..82135563a 160000 --- a/spec/integration_specs +++ b/spec/integration_specs @@ -1 +1 @@ -Subproject commit 579f9c717466edac6fab268ccfcace6b49162871 +Subproject commit 82135563acc779e65fdcbfa28cdd252ee2a9c0c3