Skip to content

Commit 764d652

Browse files
committed
perf: improve autocmd performance for self deletion
1 parent b974499 commit 764d652

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lua/astrolsp/init.lua

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,7 @@ M.on_attach = function(client, bufnr)
147147
break
148148
end
149149
end
150-
if invalid then
151-
local cb_cmds_found, cb_cmds = pcall(vim.api.nvim_get_autocmds, { group = augroup, buffer = bufnr })
152-
if cb_cmds_found then vim.tbl_map(function(cmd) vim.api.nvim_del_autocmd(cmd.id) end, cb_cmds) end
153-
else
154-
callback_func(args, client, bufnr)
155-
end
150+
return invalid or callback_func(args, client, bufnr)
156151
end
157152
vim.api.nvim_create_autocmd(event, autocmd)
158153
autocmd.callback, autocmd.command, autocmd.event = callback, command, event

0 commit comments

Comments
 (0)