You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I like my editor to be as clean as possible so I set on neo_tree_buffer_leave event to close it:
{ event = 'neo_tree_buffer_leave', handler = function(_) vim.cmd('Neotree close') end, }And it works fine until I added the file_renamed event:
{ 'nvim-neo-tree/neo-tree.nvim', opts = function(_, opts) vim.list_extend(opts.event_handlers, { { event = 'file_renamed', handler = function(args) local old_name = args.source local new_name = args.destination local stat = vim.loop.fs_stat(new_name) if not stat then return end local type = ({ file = 'file', directory = 'folder' })[stat.type] local clients = vim.lsp.get_active_clients({}) for _, client in ipairs(clients) do if check_folders_contains(client.workspace_folders, old_name) then local filters = vim.tbl_get( client.server_capabilities, 'workspace', 'fileOperations', 'didRename', 'filters' ) or {} for _, filter in pairs(filters) do if match_file_operation_filter(filter, old_name, type) and match_file_operation_filter(filter, new_name, type) then client.notify('workspace/didRenameFiles', { files = { { oldUri = uri_from_path(old_name), newUri = uri_from_path(new_name), }, }, }) end end end end end, }, }) end, }With it, every time the neo tree is opened vtsls(lsp) is reinitialized:
CleanShot.2024-01-12.at.05.26.02.mp4
If I remove the on-rename handler everything works perfectly:
CleanShot.2024-01-12.at.05.41.57.mp4
But as far as I see in the rename handler, it does not attach to any lsp. Does anyone know why could this happen?
Beta Was this translation helpful? Give feedback.
All reactions