LSP: Set current name as default rename text (#12553)

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 <>
This commit is contained in:
cbarrete 2020-06-27 20:10:19 +02:00 committed by GitHub
parent 7efb302d26
commit 48ac77a14c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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)