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

files ignores input_delay #145

Closed
arashm opened this issue Dec 2, 2019 · 8 comments
Closed

files ignores input_delay #145

arashm opened this issue Dec 2, 2019 · 8 comments

Comments

@arashm
Copy link
Contributor

arashm commented Dec 2, 2019

Environment (please complete the following information):

  • OS: Mac/Linux
  • Vim version: 8.1.2380
  • vim-clap version: master

Describe the bug
Although I have set the g:clap_popup_input_delay and it has 200ms default value, it doesn't seem to honor the value and does the search after each key press which makes it very slow on larger code bases.

The grep command does

To Reproduce
see the screenshot part

Expected behavior
It should run the search after the given time value is passed

Screenshots

vim-clap-files

I'm not typing test one character at a time, it's Clap trying to do the search and since the code base contains too many files it takes some to do the search and return the result and does it again for the next character

@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.93. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@issue-label-bot issue-label-bot bot added the bug Something isn't working label Dec 2, 2019
@liuchengxu
Copy link
Owner

See #140 . It's just slow, a performance issue of vim and vimscript.

@liuchengxu liuchengxu added performance and removed bug Something isn't working labels Dec 2, 2019
@arashm
Copy link
Contributor Author

arashm commented Dec 2, 2019

I know the search itself can be slow, but I want the search execution to be delayed until I have finished typing. That shouldn't be related to the above performance issue, is it? And it works fine for grep, I type the whole word, then the grep command is triggered and results are shown. ctrl-p has the same option that I use and it works fine for files (without input delay that would be slow too).

@liuchengxu
Copy link
Owner

liuchengxu commented Dec 2, 2019

Since you have about 8000 files, vim-clap actually uses the built-in fzy python implementation, which runs synchronously, hence it could be slow. If you have more than 10,000 files, vim-clap will switch to the async way automatically. Clap grep is always async, unless you have hundreds of thousands, it should be fast.

200ms is not much sensible, try a higher value, you'll see that the execution has been delayed.

@arashm
Copy link
Contributor Author

arashm commented Dec 2, 2019

I have tried let g:clap_popup_input_delay = 5000 and vim returns 5000 when doing :echo g:clap_popup_input_delay but it has no effect. The search still happens for every character entered.

@liuchengxu
Copy link
Owner

Ok, I know the problem. vim-clap ignores the delay in this case. The original idea is to react fast if possible, for the providers like jumps, marks are only about one hundred items. This strategy can be improved then. Try commenting out the is_sync check and see if it works better. I'll find a better way to check if it should react immediately.

" If the privder is async, react immediately, otherwise hold a delay.
" FIXME
" If the slow renderring of vim job is resolved, this cuold be removed.
if g:clap.provider.is_sync()
" apply_input should happen earlier than mock_input
call s:apply_input('')
else
call s:apply_input_with_delay()
endif

@liuchengxu liuchengxu reopened this Dec 3, 2019
@liuchengxu
Copy link
Owner

I did not find a better checker, now the delay always exists for vim.

@liuchengxu liuchengxu added the vim label Dec 3, 2019
@arashm
Copy link
Contributor Author

arashm commented Dec 3, 2019

That's awesome and works perfect. Thank you very much for great maintenance of this gem 👍

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

No branches or pull requests

2 participants