@@ -15,7 +15,6 @@ class Hover
1515 def initialize ( response_builder , global_state , uri , node_context , dispatcher , sorbet_level , position ) # rubocop:disable Metrics/ParameterLists
1616 @response_builder = response_builder
1717 @global_state = global_state
18- @index = global_state . index #: RubyIndexer::Index
1918 @graph = global_state . graph #: Rubydex::Graph
2019 @type_inferrer = global_state . type_inferrer #: TypeInferrer
2120 @path = uri . to_standardized_path #: String?
@@ -457,21 +456,22 @@ def handle_method_hover(message, inherited_only: false)
457456 type = @type_inferrer . infer_receiver_type ( @node_context )
458457 return unless type
459458
460- methods = @index . resolve_method ( message , type . name , inherited_only : inherited_only )
461- return unless methods
459+ owner = @graph [ type . name ]
460+ return unless owner . is_a? ( Rubydex :: Namespace )
462461
463- first_method = methods . first #: as !nil
464- return unless method_reachable_from_call_site? ( first_method , type , @graph , @node_context )
462+ method = owner . find_member ( "#{ message } ()" , only_inherited : inherited_only )
463+ return unless method . is_a? ( Rubydex ::Method )
464+ return unless method_reachable_from_call_site? ( method , type , @graph , @node_context )
465465
466- title = "#{ message } #{ first_method . decorated_parameters } "
467- title << first_method . formatted_signatures
466+ title = + "#{ message } #{ method . decorated_parameters } "
467+ title << method . formatted_signatures
468468
469469 if type . is_a? ( TypeInferrer ::GuessedType )
470470 title << "\n \n Guessed receiver: #{ type . name } "
471471 @response_builder . push ( "[Learn more about guessed types](#{ GUESSED_TYPES_URL } )\n " , category : :links )
472472 end
473473
474- categorized_markdown_from_index_entries ( title , methods ) . each do |category , content |
474+ categorized_markdown_from_definitions ( title , method . definitions ) . each do |category , content |
475475 @response_builder . push ( content , category : category )
476476 end
477477 end
0 commit comments