diff --git a/lua/frecency/klass.lua b/lua/frecency/klass.lua index 855555b..ca7270e 100644 --- a/lua/frecency/klass.lua +++ b/lua/frecency/klass.lua @@ -99,19 +99,21 @@ function Frecency:validate_database(force) remove_entries() return end - vim.ui.select({ "y", "n" }, { - prompt = self:message("remove %d entries from database?", #unlinked), - ---@param item "y"|"n" - ---@return string - format_item = function(item) - return item == "y" and "Yes. Remove them." or "No. Do nothing." - end, - }, function(item) - if item == "y" then - remove_entries() - else - self:notify "validation aborted" - end + vim.schedule(function() + vim.ui.select({ "y", "n" }, { + prompt = self:message("remove %d entries from database?", #unlinked), + ---@param item "y"|"n" + ---@return string + format_item = function(item) + return item == "y" and "Yes. Remove them." or "No. Do nothing." + end, + }, function(item) + if item == "y" then + remove_entries() + else + self:notify "validation aborted" + end + end) end) end