lib/jazzy/symbol_graph/symbol.rb in jazzy-0.13.6 vs lib/jazzy/symbol_graph/symbol.rb in jazzy-0.13.7

- old
+ new

@@ -11,10 +11,11 @@ attr_accessor :location # can be nil, keys :filename :line :character attr_accessor :constraints # array, can be empty attr_accessor :doc_comments # can be nil attr_accessor :availability # array, can be empty attr_accessor :generic_type_params # set, can be empty + attr_accessor :parameter_names # array, can be nil def name path_components[-1] || '??' end @@ -22,10 +23,13 @@ self.usr = hash[:identifier][:precise] self.path_components = hash[:pathComponents] raw_decl = hash[:declarationFragments].map { |f| f[:spelling] }.join init_kind(hash[:kind][:identifier]) init_declaration(raw_decl) + if func_signature = hash[:functionSignature] + init_func_signature(func_signature) + end init_acl(hash[:accessLevel]) if location = hash[:location] init_location(location) end init_constraints(hash, raw_decl) @@ -46,9 +50,16 @@ .gsub(/(?<=\(|, )_: /, '_ arg: ') .gsub(/ where.*$/, '') if kind == 'source.lang.swift.decl.class' declaration.sub!(/\s*:.*$/, '') end + end + + # Remember pieces of methods for later markdown parsing + + def init_func_signature(func_signature) + self.parameter_names = + (func_signature[:parameters] || []).map { |h| h[:name] } end # Mapping SymbolGraph's declkinds to SourceKit KIND_MAP = {