class TypeProf::LSP::Message::TextDocument::CodeLens

Constants

METHOD

Public Instance Methods

run() click to toggle source
# File typeprof-0.30.1/lib/typeprof/lsp/messages.rb, line 275
def run
  @params => { textDocument: { uri: } }
  text = @server.open_texts[uri]
  if !text || !@server.signature_enabled
    respond(nil)
    return
  end
  ret = []
  @server.core.code_lens(text.path) do |code_range, title|
    pos = code_range.first
    ret << {
      range: TypeProf::CodeRange.new(pos, pos.right).to_lsp,
      command: {
        title: "#: " + title,
        command: "typeprof.createPrototypeRBS",
        arguments: [uri, code_range.first.lineno, code_range.first.column, title],
      },
    }
  end
  respond(ret)
end