soulis-1256 / eagle.nvim

Show diagnostics and lsp info inside a custom window
Apache License 2.0
245 stars 5 forks source link

Bug: invalid window-id when using zen-mode and/or maximize-window on close-event #10

Closed joehannes closed 9 months ago

joehannes commented 9 months ago

When moving the mouse over an lsp-message in a maximized or zen-mode window/pane I get the desired floating-window with it's corresponding message.

Bug: When moving the mouse away, the window doesn't disappear, instead I get an error:

zen-mode-error:

E5108: Error executing lua: .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:279: Invalid window id: 1000                                   
stack traceback:                                                                                                                                       
        [C]: in function 'nvim_set_current_win'                                                                                                        
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:279: in function 'check_mouse_win_collision'                                       
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:246: in function <.../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:237> 

maximize-window-error:

E5108: Error executing lua: .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:279: Invalid window id: 1000                          
stack traceback:                                                                                                                                       
        [C]: in function 'nvim_set_current_win'                                                                                                        
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:279: in function 'check_mouse_win_collision'                                       
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:126: in function 'close_float_window'                                              
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:254: in function <.../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:237>

error-screenie

While it seems the error is possibly caused by other plugins (I don't know who's responsibility it should be?) ... I'd love to see you safeguard for this error in this plugin.

This plugin gets a big like from me, and I can see it being useful quite a lot...

Anyway: I frequently use maximized windows because I focus on a pane while having splits in my layout. If the error isn't fixed, I guess I'll have to disable/uninstall it and look for another solution to display my lsp-errors, which would be a pity, especially since this plugin brings value on top of my necessity. I can't have my workflow disrupted this way, having to manually/:q close my overlay every time I hover an lsp-error in a currently maximized window.

Solution: Can you safeguard the error and make the window disappear anyway? Maybe you can keep the window-id of the window in which the last overlay was triggered in some global var??? And remove the window when the caught error occurs - instead of having nvim through an error?

soulis-1256 commented 9 months ago

Hello, I think this is a pretty straight forward bug. There is a plugin in your config that changes the window id, and then my global variable that handles the base window, called "original_win" isn't being updated. I will try to push a hotfix very soon. Thanks for letting me know.

joehannes commented 9 months ago

Awesome!!

Just FYI: Following plugins in my config would be the suspects I guess: folke/zen-mode.nvim => zen-mode anuvyklack/windows.nvim => maximize (plus auto-slight-resizing & animation stuff via below deps) anuvyklack/middleclass anuvyklack/animation.nvim

soulis-1256 commented 9 months ago

Hi again, I have pushed a hotfix that I believe should fix these issues. Inform me if that's the case so I can close it.

joehannes commented 9 months ago

hey, almost there I think ... or then, actually there ...

But: In the same context of (split windows and also as of windows in other tabs) I've found another bug. I shall report in another ticket. Please feel free to close this one.