candidates re-sorted on input with frecency.nvim
Closed this issue · 4 comments
hey, there
great plugin y'all got going here. I use it everyday and it works real good
One thing I noticed is that, when used with https://github.com/nvim-telescope/telescope-frecency.nvim the candidates will get re-ordered as the user types an input.
I don't exactly know the sorting algorithm that gets used, but, while prioritizing basename as expected, the relative order of candidates won't stick.
I've tried this by inputting "wiki" to match the .wiki extension and the order between wiki files changes. Matching for my input works because I have no "wiki.something" path and "/some/path/file.wiki" has priority over "/wiki/path/file.something", but "/file/I/access/a/lot.wiki" will have lower priority "/other/file/I/have/visited/once.wiki"
I hope I've described the problem ok
Thanks for reporting! I think it all makes sense. I have never used frecency, but I'll take some time to investigate it tonight and see if there is anything I can do to fix it
@FelipeLema I took some time to read through the frecency and telescope repos. Here's what I learned. Telescope-frecency.nvim is a picker, not a sorter as I had assumed. Frecency is setting it's own sorter to be a default basic substring matcher, so telescope-zf-native is not even used at all for frecency.
I can see two solutions:
- I'm not 100% sure I understand this code, but it appears to be someone wrapping the frecency results with the fzf sorter. You could probably adapt this to use zf. nvim-telescope/telescope-frecency.nvim#49
- Submit a PR or make an issue on frecency to allow using custom sorters.
So it looks like the solution is not something I can fix in this repo. Sorry about that! Please let me know what you think before I close this.
your proposed solutions sound about right. I'll take a look at the code in that issue thread and maybe do a PR.
I'm still not familiar with telescope concepts (which is why I asked for help here). Sorry for bothering
@FelipeLema good luck getting it working! Do let me know if there is anything else I can help with in the future! And you weren't a bother! :)