(mini.files) Stops working after editing workspace via LSP actions #563
Replies: 3 comments
-
Nice dedication to creating something for yourself! I am not really sure why this is happening. I've added this slightly refactored version inside the autocommand and could not reproduce this: local file_on_rename = function(from, to)
local ok, clients = pcall(vim.lsp.get_active_clients)
if not ok or type(clients) ~= 'table' then return end
clients = vim.tbl_filter(function(x) return x.supports_method('workspace/willRenameFiles') end, clients)
for _, client in ipairs(clients) do
local resp = client.request_sync(
'workspace/willRenameFiles',
{ files = { { oldUri = vim.uri_from_fname(from), newUri = vim.uri_from_fname(to) } } },
1000,
0
)
-- I think I could close mini.files here, but I prefer to leave it open to maybe do more operations
if resp and resp.result ~= nil then vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding) end
end
end Although, I don't think there is an active proper LSP which utilizes "workspace/willRenameFiles" method. Based on the There is an easy (and probably a worthwhile) fix to call that Unfortunately, I can not help here without more details. For example:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback and the refactoring. I learned a new thing!
It happened while using
This is happening very sporadic. So, we can also close this Issue and if I have figured out more scenarios and I really see a problem with mini.files here, we could open that again. That would be fine with me, since it is very difficult to reproduce for you. |
Beta Was this translation helpful? Give feedback.
-
Yeah, without reliable way to reproduce this, it is hard to know what is going on. I will move this to discussions instead of closing. Thanks for understanding! |
Beta Was this translation helpful? Give feedback.
-
Hello!
Foremost, thank you for all the great plugins, the time you are putting into mini.nvim and the outstanding support.
Introduction
I have one small observation in mini.files. To enable LSP features, I created a custom handler that applies file renames to the workspace to update imports in all files that are using code from the renamed file. This works great and is another great layer on top of mini.files.
My problem
Neovim will open all updated files in buffers in the background, while mini.files will remain opened. Most of the time, this works without any problems but sometimes, it prints me the following error:
After that, I am not able to interact with mini.files any more. Trying to close it manually with
lua MiniFiles.close()
is also not having any effect.I know this might be hard to verify for you, but I think it is somehow related to mini.files cursor of the buffers. I am currently using version
8e18eb9
.Thanks a lot!
My current implementation
Beta Was this translation helpful? Give feedback.
All reactions