-
Notifications
You must be signed in to change notification settings - Fork 271
Description
Problem:
I am using this plugin for file rename/move operations. I would want to integrate these operations with LSP. Some LSP servers support functionality to update imports after the file is renamed or moved. Client sends workspace/willRenameFiles notification to LSP, which returns import changes. dartls supports this notification. I want a hook to file rename flow to be able to call LSP and apply returned results.
Possible implementation:
It would be nice to be able to setup this hook in neo-tree, possible implementation:
https://github.com/nvim-neo-tree/neo-tree.nvim/compare/v2.x...sidlatau:neo-tree.nvim:update-imports?expand=1
Then user needs to setup this hook:
neo_tree.setup {
...
hooks = {
on_rename_file = function(data)
("dart-lsp-refactorings").on_rename_file(data)
end,
},
}where data is:
{
source= "/path_to_source",
destination = "/path_to_destination",
callback = function()
-- Function called to finish rename process
end
}Alternatives tried:
I tried to use events infrastructure in neo-tree, added new WILL_FILE_RENAME event, but problem with them is that they does not block a flow. When request reaches LSP about renamed file, server returns empty results, I suspect file is already renamed and server does not see it. In above provided solution I can control when actual rename occurs.
I think several such hooks could be useful - for file rename, file move, maybe even for operations with folders.
Would it be feasible to add such hooks to neo-tree?
I may create PR then.