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

Don't sort if there is not filtering input #14

Closed
petobens opened this issue Oct 15, 2018 · 17 comments
Closed

Don't sort if there is not filtering input #14

petobens opened this issue Oct 15, 2018 · 17 comments

Comments

@petobens
Copy link

Hi, if I use let g:fruzzy#usenative = 0 with Denite file_mru candidates are correctly ordered by the last recent one opened first:

~/OneDrive/jampp/repos/macross/docs/docs/macross/win_rate.md
~/OneDrive/jampp/repos/macross-daat/daat/model.py
~/OneDrive/jampp/repos/macross-daat/docs/docs/estimator.md
~/OneDrive/jampp/repos/macross/docs/docs/macross/model.md
~/git-repos/private/dotfiles/setup-new/yay.sh
~/git-repos/private/dotfiles/vim/ftplugin/python/python_settings.vim
~/OneDrive/arch/install_notes.md
~/git-repos/work/ausa/store/requirements.txt
~/git-repos/private/dotfiles/python/requirements.txt
~/git-repos/private/dotfiles/setup-new/brew.sh
~/OneDrive/varios/todos_coding_setup.md
~/git-repos/private/dotfiles/vim/mysnippets/vim.snippets
~/git-repos/private/dotfiles/bashrc
~/git-repos/private/dotfiles/vim/vimrc_min
~/git-repos/private/dotfiles/vimrc
 Denite  file_mru(235/236)                                                                                      [/home/pedro/git-repos/private/dotfiles]  235/235

on the other hand if i use let g:fruzzy#usenative = 1 then I get:

~/Desktop/lela.md
~/Desktop/bar.sh
/etc/resolv.conf
~/Desktop/baz.sh
~/Desktop/bar.py
~/Desktop/foo.md
~/Desktop/api.py
~/Desktop/foo.sh
~/Desktop/foo.py
~/Desktop/baz.py
~/.bash_history
~/.Xauthority
~/.mongorc.js
~/.lesshst
~/.fehbg

So my question is: if fruzzy is a matching/filtering algorithm why is it also sorting candidates without any kind of filtering input? I expect it to honor the initial source sorting.

Another thing I've noticed is that when using the native version I get the following message before executing a denite source:

[denite] fruzzy_mod ver: rev: v0.3 on branch: master

Can that message be suppressed? Thanks in advance

@raghur
Copy link
Owner

raghur commented Oct 16, 2018

When there's no input, fruzzy native mod sorts the files by least levenshtein distance ascending. It also removes the current file from the list. This is done so that you can bounce between similar files (x.py/x_test.py or .h/.cpp) quickly.

The python version does not do this since levenshtein libraries require a native mod and I don't want to complicate the installation.

Another thing I've noticed is that when using the native version I get the following message before executing a denite source:

That log is emitted once at initialization and is there to aid me in debugging when folks report issues :)

@Shougo
Copy link
Contributor

Shougo commented Oct 16, 2018

I think the debug log should be option.
It should not printed always.

@raghur
Copy link
Owner

raghur commented Oct 16, 2018

I think the debug log should be option.
It should not printed always.

More options => more complications. Also for something this trivial and echo'ed once per vim/nvim instance, I'm going to keep it the way it is.

@Shougo
Copy link
Contributor

Shougo commented Oct 16, 2018

I don't like the option too. But I don't like the echo message.

@Shougo
Copy link
Contributor

Shougo commented Oct 16, 2018

I think logger.debug() is better for it.

@raghur
Copy link
Owner

raghur commented Oct 16, 2018

logger.debug is useful during development - but that needs NVIM_PYTHON_LOG_LEVEL and NVIM_PYTHON_LOG_FILE to be set. Giving instructions to folks who're looking for support to setup logging and then grep through a huge log file vs "Hey - tell me what you see in :messages" is the difference.

@Shougo
Copy link
Contributor

Shougo commented Oct 16, 2018

Yes. But it is only used for debug.
It should not printed always.

@Shougo
Copy link
Contributor

Shougo commented Oct 16, 2018

If it is error, it should be printed always.
But the message is not.

@raghur
Copy link
Owner

raghur commented Oct 16, 2018

I don't think we're going to agree on this :). While I see your point, for me, user convenience trumps other aspects. However, I'll think about adding something like fruzzy#version() to print out the revision

@Shougo
Copy link
Contributor

Shougo commented Oct 16, 2018

fruzzy#version() is better for me.

@petobens
Copy link
Author

When there's no input, fruzzy native mod sorts the files by least levenshtein distance ascending. It also removes the current file from the list. This is done so that you can bounce between similar files (x.py/x_test.py or .h/.cpp) quickly.
The python version does not do this since levenshtein libraries require a native mod and I don't want to complicate the installation.

Can I disable this behaviour while still use the native mod? Also I read your post but I'm not quite sure if there are, at a user level, noticeable differences between the python version and the native. In other words, if there aren't big differences and you prefer not to change this initial sorting setting then my question is: do I loose any feature of the matcher by using the python version instead of the native one? Once again thanks!

@Shougo
Copy link
Contributor

Shougo commented Oct 17, 2018

I don't think the behavior is so useful...

@raghur
Copy link
Owner

raghur commented Oct 17, 2018

Can I disable this behaviour while still use the native mod?

Not at the moment.

I'm not quite sure if there are, at a user level, noticeable differences between the python version and the native.

There are no differences other than this. Both have to pass the same tests. I'll probably add an option so that users can opt out if they want (till then you can switch to python version)

I don't think the behavior is so useful...

I actually sort of agree. When it works, it's really useful. When it doesn't, it leaves me head scratching. Till now I've found out that it doesn't work well with neomru (since that uses absolute paths). It seems to work well with file/file_rec though. Also, on windows, it seems to be more wonky due to path separator differences.

@raghur raghur closed this as completed Oct 17, 2018
@raghur
Copy link
Owner

raghur commented Oct 17, 2018

Can I disable this behaviour while still use the native mod?

pull from master now. Set g:fruzzy#sortonempty=0 in your .vimrc. You can use it with the native mod now.

@petobens
Copy link
Author

petobens commented Oct 17, 2018

@raghur thanks for the change. However I'm trying with

let g:fruzzy#sortonempty=0

but entries are still sorted relative to the current file when using Denite file_mru. Can you reproduce this?

Edit: oh you already said that in your comment. So this is expected? (i.e it's a feature rather than a bug?)

@raghur
Copy link
Owner

raghur commented Oct 18, 2018

There was a bug that would have sorted entries even when sort on empty was set. I've now fixed Pls update and check.

@petobens
Copy link
Author

Thank you!

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

3 participants