Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

candidates re-sorted on input with frecency.nvim #6

Closed
FelipeLema opened this issue Jul 26, 2022 · 4 comments
Closed

candidates re-sorted on input with frecency.nvim #6

FelipeLema opened this issue Jul 26, 2022 · 4 comments

Comments

@FelipeLema
Copy link

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

@natecraddock
Copy link
Owner

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

@natecraddock
Copy link
Owner

@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:

  1. 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. Use frecency with git_files nvim-telescope/telescope-frecency.nvim#49
  2. 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.

@FelipeLema
Copy link
Author

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

@natecraddock
Copy link
Owner

@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! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants