class TypeProf::LSP::Message::TextDocument::References

Constants

METHOD

Public Instance Methods

run() click to toggle source
# File typeprof-0.21.2/lib/typeprof/lsp.rb, line 642
def run
  case @params
  in {
    textDocument: { uri:, },
    position: loc,
  }
  else
    raise
  end

  caller_table = @server.open_texts[uri]&.caller_table
  code_locations = caller_table[CodeLocation.from_lsp(loc)] if caller_table
  if code_locations
    respond(
      code_locations.map do |path, code_range|
        {
          uri: "file://" + path,
          range: code_range.to_lsp,
        }
      end
    )
  else
    respond(nil)
  end
end