class RubyLsp::Listeners::DocumentLink

def initialize(response_builder, uri, comments, dispatcher)

: (ResponseBuilders::CollectionResponseBuilder[Interface::DocumentLink] response_builder, URI::Generic uri, Array[Prism::Comment] comments, Prism::Dispatcher dispatcher) -> void
def initialize(response_builder, uri, comments, dispatcher)
  # Match the version based on the version in the RBI file name. Notice that the `@` symbol is sanitized to `%40`
  # in the URI
  @response_builder = response_builder
  path = uri.to_standardized_path
  version_match = path ? /(?<=%40)[\d.]+(?=\.rbi$)/.match(path) : nil
  @gem_version = version_match && version_match[0] #: String?
  @lines_to_comments = comments.to_h do |comment|
    [comment.location.end_line, comment]
  end #: Hash[Integer, Prism::Comment]
  dispatcher.register(
    self,
    :on_def_node_enter,
    :on_class_node_enter,
    :on_module_node_enter,
    :on_constant_write_node_enter,
    :on_constant_path_write_node_enter,
  )
end