From 48ac77a14c65c18f1f4cd4ac8e657c645e9ca101 Mon Sep 17 00:00:00 2001 From: cbarrete <62146989+cbarrete@users.noreply.github.com> Date: Sat, 27 Jun 2020 20:10:19 +0200 Subject: [PATCH] LSP: Set current name as default rename text (#12553) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 <> --- runtime/lua/vim/lsp/buf.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 81d78c8b98..e1ddfb7efa 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -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('')) if not (new_name and #new_name > 0) then return end params.newName = new_name request('textDocument/rename', params)