Open tpict opened 3 years ago
I took a crack at implementing this by using opts.fzy_mod
to extract the symbol from each line before passing to fzy.score
. Results are better, but I think some kind of heuristic is needed to give a bonus score if the filename also matches. I don't know fzy
well enough yet to do this.
Before:
After:
Also, smart case is helpful when navigating tags, especially in OO languages with thing = new Thing()
patterns everywhere.
Does Telescope tags only_sort_tags=true
help you? For smart case you should look into https://github.com/nvim-telescope/telescope-fzf-native.nvim. It also support multiple patterns which are separated by a space.
only_sort_tags
has the same behavior as my custom code, thanks!
I'm still looking to get the behavior closer to the tags builtin in fzf.vim, where matches get a bonus if the filename matches too. This improves results IMO as definitions tend to be stored in a file with a relevant name. For example, with only_sort_tags
, a search for MyClass
might bring up results like
src/stuff/MyClass.js class MyClass {
> src/aaaa/aaaa/aaa.js var MyClass = require(...)
where some unrelated file has been ranked more favorably.
Is your feature request related to a problem? Please describe. The builtin
tags
picker filters the list based on the filename, not the symbol.For example, if I typed
dog
to find theDog
class from a module namedanimals.py
, that class would be ranked below a module nameddogma.py
that doesn't contain the symbolDog
at all.Describe the solution you'd like Rank lines that match on the symbol more favorably than those that match on the filename.
Thank you!