class RubyLsp::ResponseBuilders::TestCollection

: [ResponseType = Requests::Support::TestItem]

def [](id)

: (String id) -> ResponseType?
def [](id)
  @items[id]
end

def add(item)

: (ResponseType item) -> void
def add(item)
  @items[item.id] = item
end

def add_code_lens(item)

: (ResponseType item) -> void
def add_code_lens(item)
  arguments = [item.uri.to_standardized_path, item.id]
  start = item.range.start
  range = Interface::Range.new(
    start: start,
    end: Interface::Position.new(line: start.line, character: start.character + 1),
  )
  @code_lens << Interface::CodeLens.new(
    range: range,
    data: { arguments: arguments, kind: "run_test" },
  )
  @code_lens << Interface::CodeLens.new(
    range: range,
    data: { arguments: arguments, kind: "run_test_in_terminal" },
  )
  @code_lens << Interface::CodeLens.new(
    range: range,
    data: { arguments: arguments, kind: "debug_test" },
  )
end

def initialize

: -> void
def initialize
  super
  @items = {} #: Hash[String, ResponseType]
  @code_lens = [] #: Array[Interface::CodeLens]
end

def response

: -> Array[ResponseType]
@override
def response
  @items.values
end