The async logic does not respect the api.open { new = false }
calls
#492
Labels
bug
Something isn't working
api.open { new = false }
calls
#492
Did you check docs and existing issues?
Neovim version (nvim -v)
0.11
Operating system/version
ubuntu22.04
Describe the bug
Hello, after several days of deep usage, I feel that although the V3 version has undergone significant restructuring compared to the previous version, it is still very much worth updating. Thank you very much for your efforts @folke.
During usage, I found that sources like
lsp_xxx
do not respect the decision ofapi.open({ new = false })
. This issue is particularly important for some slower LSPs. It is very difficult to clearly and completely describe an issue, so I recorded a video to demonstrate the problem I encountered (I will add any more info in the comments if needed). At the beginning of the video, I show that I have boundapi.open
to thede
key and setnew = false
when callingapi.open
. Then, immediately after I first entered the editor, I quickly pressed the de key four times in succession. There was no response at this time, which I understand is because the LSP was too slow, so I started to wait. After a few seconds, three trouble windows popped up in succession, along with an additional warning message with no source found.2024-06-08.175012.mp4
I'm not certain if this is the intended behavior, as my in-depth research revealed that the code only considers the
open = true
scenario. When open is initially called, a temporary view is stored introuble.view._views
until any data (potentially fetched asynchronously) fills this view and it gets displayed (ifopen_no_results = true
). In my opinion, it’s necessary to include this intermediate state view within the scope ofapi.open({ new = false })
. Should clarify that this is just my personal opinion, and I will respect any perspectives on your intended design.trouble.nvim/lua/trouble/api.lua
Lines 47 to 49 in 806c504
trouble.nvim/lua/trouble/api.lua
Line 23 in 806c504
Anyway, at least until this is properly "fixed", I am compensating for the logic of
api.open({ new = false })
on the user side by hijacking thetrouble.view.refresh
function to broadcast whether the specified trouble mode is open. This is undoubtedly a very ugly and hacky solution.Steps To Reproduce
see above
Expected Behavior
see above
Repro
The text was updated successfully, but these errors were encountered: