From 880e89eadbc92e9da27c85dce0b9535dcef9b057 Mon Sep 17 00:00:00 2001 From: JINNOUCHI Yasushi Date: Sat, 13 Jul 2024 23:21:01 +0900 Subject: [PATCH] fix: delay setup not to avoid bg color detection (#213) Fix #210 --- lua/frecency/init.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lua/frecency/init.lua b/lua/frecency/init.lua index 5820dfe..e2cbd5a 100644 --- a/lua/frecency/init.lua +++ b/lua/frecency/init.lua @@ -28,10 +28,14 @@ end ---This is called when `:Telescope frecency` is called at the first time. ---@return nil function Frecency:setup() - self:assert_db_entries() - if config.auto_validate then - self:validate_database() - end + -- HACK: Wihout this wrapping, it spoils background color detection. + -- See https://github.com/nvim-telescope/telescope-frecency.nvim/issues/210 + vim.defer_fn(function() + self:assert_db_entries() + if config.auto_validate then + self:validate_database() + end + end, 0) end ---This can be calledBy `require("telescope").extensions.frecency.frecency`.