class TypeProf::LSP::Message::TextDocument::Rename - typeprof: Ruby Standard Library Documentation

# class TypeProf::LSP::Message::TextDocument::Rename

textDocument/prepareRename request

### Constants

METHOD

### Public Instance Methods

run() click to toggle source

    # File typeprof-0.30.1/lib/typeprof/lsp/messages.rb, line 346
    def run
      @params => {
        textDocument: { uri: },
        position: pos,
        newName:,
      }
      text = @server.open_texts[uri]
      unless text
        respond(nil)
        return
      end
      renames = @server.core.rename(text.path, TypeProf::CodePosition.from_lsp(pos))
      if renames
        changes = {}
        renames.each do |path, cr|
          (changes[@server.path_to_uri(path)] ||= []) << {
            range: cr.to_lsp,
            newText: newName,
          }
        end
        respond({
          changes:,
        })
      else
        respond(nil)
      end
    end