|
|
@@ -169,21 +169,30 @@ vim.api.nvim_create_autocmd('User', {
|
|
|
}
|
|
|
local bufnr = vim.fn.bufadd(opts.data.to)
|
|
|
|
|
|
- local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
|
|
- for _, client in ipairs(clients) do
|
|
|
- if client:supports_method('workspace/willRenameFiles') then
|
|
|
- local resp = client:request_sync('workspace/willRenameFiles', params, 5000, bufnr)
|
|
|
- if resp and resp.result ~= nil then
|
|
|
- vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding)
|
|
|
+ -- delay a bit to allow LSP clients to attach
|
|
|
+ vim.defer_fn(function()
|
|
|
+ local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
|
|
+ for _, client in ipairs(clients) do
|
|
|
+ vim.notify(client.name)
|
|
|
+ if client.name == 'dprint' then
|
|
|
+ goto continue
|
|
|
end
|
|
|
+ if client:supports_method('workspace/willRenameFiles') then
|
|
|
+ vim.notify('lsp rename')
|
|
|
+ local resp = client:request_sync('workspace/willRenameFiles', params, 5000, bufnr)
|
|
|
+ if resp and resp.result ~= nil then
|
|
|
+ vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding)
|
|
|
+ end
|
|
|
+ end
|
|
|
+ ::continue::
|
|
|
end
|
|
|
- end
|
|
|
|
|
|
- for _, client in ipairs(clients) do
|
|
|
- if client:supports_method('workspace/didRenameFiles') then
|
|
|
- client:notify('workspace/didRenameFiles', params)
|
|
|
+ for _, client in ipairs(clients) do
|
|
|
+ if client:supports_method('workspace/didRenameFiles') then
|
|
|
+ client:notify('workspace/didRenameFiles', params)
|
|
|
+ end
|
|
|
end
|
|
|
- end
|
|
|
+ end, 100)
|
|
|
end,
|
|
|
nested = true,
|
|
|
})
|