aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorcbarrete <62146989+cbarrete@users.noreply.github.com>2020-06-27 20:10:19 +0200
committerGitHub <noreply@github.com>2020-06-27 20:10:19 +0200
commit48ac77a14c65c18f1f4cd4ac8e657c645e9ca101 (patch)
tree66574ceb20f9fee3b8b24adb7dcfd0abb9326d84 /runtime/lua/vim
parent7efb302d26abd863e2cbbf4d2d6f7bb4aa31cc29 (diff)
downloadrneovim-48ac77a14c65c18f1f4cd4ac8e657c645e9ca101.tar.gz
rneovim-48ac77a14c65c18f1f4cd4ac8e657c645e9ca101.tar.bz2
rneovim-48ac77a14c65c18f1f4cd4ac8e657c645e9ca101.zip
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 <>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/lsp/buf.lua2
1 files changed, 1 insertions, 1 deletions
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('<cword>'))
if not (new_name and #new_name > 0) then return end
params.newName = new_name
request('textDocument/rename', params)