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

Issus #1836: add view.debounce_delay, avoid some unnecessary reloads #1855

Closed
wants to merge 1 commit into from

Conversation

D0ot
Copy link
Contributor

@D0ot D0ot commented Dec 24, 2022

add DEFAULT_OPTS.view.debounce_delay and view.debounce_delay.

accidentally close the old PR #1830, I just created a new one...

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this one. Tested

  • buffer switching - filter disabled
  • filter enabled
  • 1s debounce
  • bw :
Error detected while processing BufUnload Autocommands for "*":
Error executing lua callback: ...-dev/site/pack/packer/start/D0ot/lua/nvim-tree/utils.lua:383: bad argument #1 to 'start' (number expected, got nil)
stack traceback:
        [C]: in function 'start'
        ...-dev/site/pack/packer/start/D0ot/lua/nvim-tree/utils.lua:383: in function 'debounce'
        /tmp/nvt-dev/site/pack/packer/start/D0ot/lua/nvim-tree.lua:385: in function </tmp/nvt-dev/site/pack/packer/start/D0ot/lua/nvim-tree.lua:379>

Suggestion:
Remove debounce from unload. It's a rare use case that doesn't warrant debounce.

@@ -368,7 +368,9 @@ local function setup_autocommands(opts)
(filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none")
and vim.bo[data.buf].buftype == ""
then
reloaders.reload_explorer()
utils.debounce("BufReadPost:filter_buffer", view.debounce_delay, function()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One context should work well.

@alex-courtis
Copy link
Member

Thank you for your contribution @D0ot this has been merged into #1871 and into master.

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

Successfully merging this pull request may close these issues.

2 participants