folke / noice.nvim

💥 Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
Apache License 2.0
4.18k stars 95 forks source link

bug: Noice is causing NeoVim on macOS to hang on exit #921

Open duckpuppy opened 1 month ago

duckpuppy commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.1

Operating system/version

macOS 14.5

Describe the bug

After commit 1698725a663aca56bcd07a0e405bc441a5f6613b and using Noice via LazyVim, I'm seeing hangs for several seconds (5-10) when exiting NeoVim on macOS. I couldn't reproduce the issue on another OS. There are some weird behaviors - it's only happening when a buffer is open on a file in a git repo, if no buffers are open at all it doesn't hang, and most of the time simply entering the command line (thus invoking Noice) and just hitting ESC stops the hang from happening on a subsequent :q. It's most noticeable to me when running nvim to look at a file in a git repo and exiting without doing anything but navigation (the only command issued is :q).

See discussion here

Steps To Reproduce

  1. Clone LazyVim's starter template as directed to use as your neovim config
  2. Start neovim with nvim <file in git repo>
  3. Immediately type :q to quit.

Expected Behavior

NeoVim exits immediately upon issuing the quit command.

Repro

Basic LazyVim starter
duckpuppy commented 1 month ago

Pinning Noice to the commit prior to the one mentioned removes the problem for me. Done using the below line in my personal ~/.config/nvim/lua/plugins/init.lua file.

{ "folke/noice.nvim", enabled = true, commit = "d9328ef903168b6f52385a751eb384ae7e906c6f" },
b0ae989c commented 1 month ago

Similar issue on macOS. Are we sure the nvim__redraw API is stable enough to use?

telbizov commented 1 month ago

I see the same issue here. However, reverting to the previous commit only improves the hang time, it doesn't really solve the problem entirely. I have been noticing this issue for about a month or more now. Disable noice altogether completely eliminates the problem for me.

I experience it only when working on rust files with LSP. Exiting with :wq hangs the UI for about 2-3 seconds. Exiting with only :q never hangs.

akthe-at commented 1 month ago

I can add that I have been noticing this as well. OS: Windows 10 nvim ver: 0.10.1

Not all file types...seems to be certain filetypes...perhaps when an lsp is attached as well? I was able to capture this error message but felt like I couldn't find it in any logs.

image

mau-mauricelim commented 1 month ago

I am noticing a similar issue of hanging on exit as well on Windows on both Ubuntu and Alpine WSL. When I exit with :x on nvim, the screen freezes with the Noice command line box arrow before fully exiting. Using: NVIM v0.10.0 2024-07-28 14-11-08

When I tried disabling Noice plugin, the issue resolves.

I don’t think my issue is related to file types or LSP. Reverting to tag v4.4.7 or the previous commit d9328ef903168b6f52385a751eb384ae7e906c6f as mentioned by @duckpuppy solves the issue.

duckpuppy commented 1 month ago

Mine has nothing to do with filetypes or attached LSPs. It's all or nothing, only that there's an open buffer with a file that resides in a git repo.

On Sat, Jul 27, 2024, 10:47 AM mau-mauricelim @.***> wrote:

I am noticing a similar issue as well on Windows on both Ubuntu and Alpine WSL. When I exit with :x nvim, the screen freezes with the Noice command line box arrow before fully exiting.

— Reply to this email directly, view it on GitHub https://github.com/folke/noice.nvim/issues/921#issuecomment-2254168546, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEWNIBVHRV7BH3KTJ7JA3ZOOXGLAVCNFSM6AAAAABLRCNPLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGE3DQNJUGY . You are receiving this because you authored the thread.Message ID: @.***>

LowArmour commented 1 month ago

Just to add that this also happens on Fedora 40.

Reverting to the prior commit as instructed above by @duckpuppy solves the problem.

The hangs usually last between 2 and even 60 - 90 seconds.

xyven1 commented 1 month ago

Seeing the same issue on Ubuntu 22, and again, the commit @duckpuppy 's mentions fixes it.

GeoffreyBrunet commented 1 month ago

Same problem, error on screenshot :)

Capture d’écran 2024-08-08 à 21 16 32
n-crespo commented 4 weeks ago

I used redir! > ~/some/path/nvim_msgs.txt to see the error log right before neovim exits and essentially got the same as what other people did but x4:

Error executing vim.schedule lua callback: ...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: Cursor position outside buffer
stack traceback:
    [C]: in function 'nvim_win_set_cursor'
    ...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: in function 'fix_cursor'
    ...ocal/share/nvim/lazy/noice.nvim/lua/noice/util/hacks.lua:43: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
Error executing vim.schedule lua callback: ...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: Cursor position outside buffer
stack traceback:
    [C]: in function 'nvim_win_set_cursor'
    ...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: in function 'fix_cursor'
    ...ocal/share/nvim/lazy/noice.nvim/lua/noice/util/hacks.lua:43: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
Error executing vim.schedule lua callback: ...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: Cursor position outside buffer
stack traceback:
    [C]: in function 'nvim_win_set_cursor'
    ...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: in function 'fix_cursor'
    ...ocal/share/nvim/lazy/noice.nvim/lua/noice/util/hacks.lua:43: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
Error executing vim.schedule lua callback: ...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: Cursor position outside buffer
stack traceback:
    [C]: in function 'nvim_win_set_cursor'
    ...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: in function 'fix_cursor'
    ...ocal/share/nvim/lazy/noice.nvim/lua/noice/util/hacks.lua:43: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
6H075T2 commented 2 weeks ago

This happens to me too quite a lot honestly when I'm using Windows Terminal btw

Baughn commented 2 weeks ago

Same thing on NixOS. It seems much worse for files that load a lot of plugins, e.g. Rust.

Unfortunately Noice is in the default lazyvim configuration, so this is affecting a lot of people.

dennis-lookin commented 1 week ago

Same problem for me on Linux, but only when I'm using Vue LSP and do :qa after editing a few files. I tried different terminals but result is the same, it hangs on for ~1 minute and throws the error

Ghanshyam-shaktawat commented 1 week ago

Hey, I am facing a similar issue, when i tried exiting neovim it takes about 2-3 seconda to exit. Its a bit annyoing when working. I am on arch linux and on latest version of neovim.