mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-24 09:48:59 +02:00
feat(mini.files): added lsp rename support to mini.files
This commit is contained in:
parent
fe341e6b97
commit
4ff51cd678
3 changed files with 30 additions and 13 deletions
|
@ -299,4 +299,25 @@ function M.changelog()
|
|||
vim.diagnostic.disable(float.buf)
|
||||
end
|
||||
|
||||
---@param from string
|
||||
---@param to string
|
||||
function M.on_rename(from, to)
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
for _, client in ipairs(clients) do
|
||||
if client:supports_method("workspace/willRenameFiles") then
|
||||
local resp = client.request_sync("workspace/willRenameFiles", {
|
||||
files = {
|
||||
{
|
||||
oldUri = vim.uri_from_fname(from),
|
||||
newUri = vim.uri_from_fname(to),
|
||||
},
|
||||
},
|
||||
}, 1000)
|
||||
if resp and resp.result ~= nil then
|
||||
vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue