nvim-telescope / telescope-frecency.nvim

A telescope.nvim extension that offers intelligent prioritization when selecting files from your editing history.
MIT License
787 stars 37 forks source link

On first Telescope frecency there is a A pretyped in telescope #270

Open fishman opened 2 weeks ago

fishman commented 2 weeks ago

I don't know how to debug this, but whenever I do :Telescope frecency on the first vim start it shows an 'A' character prefilled in the Telescope window. Is there any way to see what that could be from?

fishman commented 2 weeks ago
      vim.keymap.set('n', '<leader>fr', require('telescope').extensions.frecency.frecency, { desc = '[F]ind Recent Files ("." for repeat)' })

After starting it manually with :Telescope frecency it asked me to remove 12 entries from the frecency database, and after agreeing to it the issue disappeared.

delphinus commented 1 week ago

It might output some escape sequences with vim.ui.select dialog and you've seen a part of that: A, maybe.

Hmm……, I am thinking to disable this dialog in default for avoiding such annoyance.

solson commented 1 week ago

I also started noticing this behavior recently, and starting it manually with :Telescope frecency doesn't seem to help - that also just opens it with "A" pretyped (if it's the first run). I never get a dialog asking me to remove any entries.

solson commented 1 week ago

I did some git bisecting and found "673585ee997b40d2600eb86c3693d552e4f5d79f is the first bad commit".

Specifically, if I run :Telescope frecency before that commit, I get a popup saying [Telescope-Frecency] remove 16 entries from database?, but if I run :Telescope frecency any time after that commit, I get no popup and I get the prefilled A.

solson commented 1 week ago

On a separate note, I never understood what that popup was for, back when it worked. It doesn't specify what's special about the 16 entries it's asking me to delete, or why I would want to do so.

It seems like I will most likely either always say Yes or always say No, so maybe it could be a config boolean, and remove the need for a popup dialog entirely?

...on reviewing the code, I discovered there's already a flag for suppressing the popups. Setting db_safe_mode = false seems to stand for "always say Yes", and with this config setting I can use the newest commit in the repo without the prefilled A problem!

tl;dr @fishman if you see this issue re-occur and want a workaround, try setting db_safe_mode = false in the frecency config. (Official docs for more nuance.)