Skip to content

Commit

Permalink
LSP: Set current name as default rename text (neovim#12553)
Browse files Browse the repository at this point in the history
Since we don't know what the server considers to be a symbol, `cword` is
the best bet in most cases.

Co-authored-by: Cédric Barreteau <>
  • Loading branch information
cbarrete authored Jun 27, 2020
1 parent 7efb302 commit 48ac77a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/lua/vim/lsp/buf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function M.rename(new_name)
-- TODO(ashkan) use prepareRename
-- * result: [`Range`](#range) \| `{ range: Range, placeholder: string }` \| `null` describing the range of the string to rename and optionally a placeholder text of the string content to be renamed. If `null` is returned then it is deemed that a 'textDocument/rename' request is not valid at the given position.
local params = util.make_position_params()
new_name = new_name or npcall(vfn.input, "New Name: ")
new_name = new_name or npcall(vfn.input, "New Name: ", vfn.expand('<cword>'))
if not (new_name and #new_name > 0) then return end
params.newName = new_name
request('textDocument/rename', params)
Expand Down

0 comments on commit 48ac77a

Please sign in to comment.