Closed AThePeanut4 closed 3 weeks ago
Sidenote:
I should probably make a separate discussion/bug about this, but I had issues with auto_jump
not working at all because I didn't understand how Trouble merges opts for modes. For the lsp_references
mode, for example, the priority seems to be custom lsp_references opts
- default lsp_references opts
- custom lsp_base opts
- default lsp_base opts
- custom global opts
- default global opts
.
It means that if I wanted to disable auto_jump
for all modes, just setting auto_jump = false
in the global setup table is not enough, because the lsp_*
modes set auto_jump = true
in their own default opts tables. I would have to set auto_jump = false
in each lsp_*
custom opts table for it to work. Is this intentional? At least for options like auto_jump
, auto_refresh
, focus
, etc I think it would make more sense to have any custom settings have priority over all default settings. Doing that for all opts might be a bad idea though. Either way, it should probably be documented somewhere :)
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.11.0-dev-196+g2ce4a4d91e
Operating system/version
Arch Linux
Describe the bug
Due to 39595e883e2f91456413ca4df287575d31665940 (which fixed #485), running actions always refreshes the Trouble window, even if
auto_refresh = false
.The specific case that's a problem for me is the
next
/prev
actions. I use<C-j>
and<C-k>
as a Trouble analog to:cnext
and:cprev
- they jump to the next/previous item without the cursor having to be in the Trouble window. However if I use them with e.g. an LSP source, the source refreshes every time, potentially changing the items in the window.Steps To Reproduce
nvim -u repro.lua
foo()
call:Trouble lsp_references
or usegd
to show referencesbar()
call:Trouble next jump=true
or use<C-j>
foo()
call, but the Trouble window has refreshed to now show references to thebar()
call.Expected Behavior
If
auto_refresh = false
, the view should not refresh when actions are run, except for when callingopen
(i.e. #485).It would also be nice to have a function that does exactly the same as
open()
, but without actually opening the view or creating a new one, to be able to get at the view object without refreshing it. Usingtrouble.view.get()
works, but it doesn't supportmode = "last"
, and I'm not sure if it's considered part of the public API? Basically a non-private_find
and_find_last
, without the opts return value.Repro