diff --git a/lib/jazzy/sourcekitten.rb b/lib/jazzy/sourcekitten.rb index 880e3f1fc..c056ba82c 100644 --- a/lib/jazzy/sourcekitten.rb +++ b/lib/jazzy/sourcekitten.rb @@ -591,9 +591,11 @@ def self.make_source_declarations(docs, parent = nil, mark = SourceMark.new) inherited_types = doc['key.inheritedtypes'] || [] declaration.inherited_types = inherited_types.map { |type| type['key.name'] }.compact - if xml_declaration = doc['key.fully_annotated_decl'] - declaration.async = swift_async?(xml_declaration) - end + declaration.async = + doc['key.async'] || + if xml_declaration = doc['key.fully_annotated_decl'] + swift_async?(xml_declaration) + end next unless make_doc_info(doc, declaration) declaration.children = make_substructure(doc, declaration) diff --git a/lib/jazzy/symbol_graph/sym_node.rb b/lib/jazzy/symbol_graph/sym_node.rb index 31f799018..770e7673b 100644 --- a/lib/jazzy/symbol_graph/sym_node.rb +++ b/lib/jazzy/symbol_graph/sym_node.rb @@ -23,6 +23,7 @@ def children_to_sourcekit # A SymNode is a node of the reconstructed syntax tree holding a symbol. # It can turn itself into SourceKit and helps decode extensions. + # rubocop:disable Metrics/ClassLength class SymNode < BaseNode attr_accessor :symbol attr_writer :override @@ -111,6 +112,11 @@ def inherits_clause " : #{superclass_name}" end + # approximately... + def async? + symbol.declaration =~ /async[^\)]*$/ + end + def full_declaration symbol.availability .append(symbol.declaration + inherits_clause + where_clause) @@ -129,6 +135,7 @@ def to_sourcekit 'key.accessibility' => symbol.acl, 'key.parsed_decl' => declaration, 'key.annotated_decl' => xml_declaration, + 'key.async' => async?, } if docs = symbol.doc_comments hash['key.doc.comment'] = docs @@ -158,5 +165,6 @@ def <=>(other) symbol <=> other.symbol end end + # rubocop:enable Metrics/ClassLength end end