nvim-telescope / telescope-frecency.nvim

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

A file opened at the first time is recorded `count = 0` #107

Closed delphinus closed 1 year ago

delphinus commented 1 year ago

When opening a file you have never opened before, it inserts a record containing count = 0, instead of count = 1. So the score will be calculated into 0 -- the same score as the one you've never opened.

This significant bug is introduced #93 (this is taken over from #35). I will fix this in #100.


Before #35, it inserts count = 1 in this line before.

INSERT INTO files (path, count) VALUES ('/path/to/file', 1);

https://github.com/nvim-telescope/telescope-frecency.nvim/blob/459041fb42d81c65444b147d25b1e28b0c8ac8f9/lua/telescope/_extensions/frecency/sql_wrapper.lua#L158

In #93 and the current master, it inserts count = 0.

INSERT INTO files (path, count) VALUES ('/path/to/file', 0);

https://github.com/nvim-telescope/telescope-frecency.nvim/blob/62d3381a32ae541233b03a129ece0aeced30ad5e/lua/frecency/db.lua#L122-L122

https://github.com/nvim-telescope/telescope-frecency.nvim/blob/62d3381a32ae541233b03a129ece0aeced30ad5e/lua/frecency/db.lua#L36-L40