lib/steep/project/hover_content.rb in steep-0.18.0 vs lib/steep/project/hover_content.rb in steep-0.19.0

- old
+ new

@@ -2,11 +2,17 @@ class Project class HoverContent TypeContent = Struct.new(:node, :type, :location, keyword_init: true) VariableContent = Struct.new(:node, :name, :type, :location, keyword_init: true) MethodCallContent = Struct.new(:node, :method_name, :type, :definition, :location, keyword_init: true) - DefinitionContent = Struct.new(:node, :method_name, :method_type, :definition, :location, keyword_init: true) + DefinitionContent = Struct.new(:node, :method_name, :method_type, :definition, :location, keyword_init: true) do + def comment_string + if comments = definition&.comments + comments.map {|c| c.string.chomp }.uniq.join("\n----\n") + end + end + end InstanceMethodName = Struct.new(:class_name, :method_name) SingletonMethodName = Struct.new(:class_name, :method_name) attr_reader :project @@ -78,19 +84,19 @@ factory = context.type_env.subtyping.factory method_name, definition = case receiver_type when AST::Types::Name::Instance method_definition = method_definition_for(factory, receiver_type.name, instance_method: method_name) if method_definition&.defined_in - owner_name = factory.type_name(method_definition.defined_in.name.absolute!) + owner_name = factory.type_name(method_definition.defined_in) [ InstanceMethodName.new(owner_name, method_name), method_definition ] end when AST::Types::Name::Class method_definition = method_definition_for(factory, receiver_type.name, singleton_method: method_name) if method_definition&.defined_in - owner_name = factory.type_name(method_definition.defined_in.name.absolute!) + owner_name = factory.type_name(method_definition.defined_in) [ SingletonMethodName.new(owner_name, method_name), method_definition ] end