class RubyLsp::Store

def cache_fetch(uri, request_name, &block)

def cache_fetch(uri, request_name, &block)
  get(uri).cache_fetch(request_name, &block)
end

def clear

def clear
  @state.clear
end

def delete(uri)

def delete(uri)
  @state.delete(uri.to_s)
end

def empty?

def empty?
  @state.empty?
end

def get(uri)

def get(uri)
  document = @state[uri.to_s]
  return document unless document.nil?
  path = T.must(uri.to_standardized_path)
  set(uri: uri, source: File.binread(path), version: 0)
  T.must(@state[uri.to_s])
end

def initialize

def initialize
  @state = T.let({}, T::Hash[String, Document])
  @encoding = T.let(Constant::PositionEncodingKind::UTF8, String)
  @formatter = T.let("auto", String)
  @supports_progress = T.let(true, T::Boolean)
  @experimental_features = T.let(false, T::Boolean)
  @workspace_uri = T.let(URI::Generic.from_path(path: Dir.pwd), URI::Generic)
  @features_configuration = T.let(
    {
      inlayHint: RequestConfig.new({
        enableAll: false,
        implicitRescue: false,
        implicitHashValue: false,
      }),
    },
    T::Hash[Symbol, RequestConfig],
  )
  @client_name = T.let("Unknown", String)
end

def push_edits(uri:, edits:, version:)

def push_edits(uri:, edits:, version:)
  T.must(@state[uri.to_s]).push_edits(edits, version: version)
end

def set(uri:, source:, version:)

def set(uri:, source:, version:)
  document = RubyDocument.new(source: source, version: version, uri: uri, encoding: @encoding)
  @state[uri.to_s] = document
end