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

Constants

METHOD

Public Instance Methods

run() click to toggle source
# File typeprof-0.30.1/lib/typeprof/lsp/messages.rb, line 228
def run
  @params => {
    textDocument: { uri: },
    position: pos,
  }
  text = @server.open_texts[uri]
  unless text
    respond(nil)
    return
  end
  callsites = @server.core.references(text.path, TypeProf::CodePosition.from_lsp(pos))
  if callsites
    respond(callsites.map do |path, code_range|
      {
        uri: @server.path_to_uri(path),
        range: code_range.to_lsp,
      }
    end)
  else
    respond(nil)
  end
end