-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
Fix erratic inspector behavior when multiple REPLs are connected #2454
Conversation
Seems like a reasonable approach to me. Another would be to link the inspector buffer to the current sesman session when it's created I guess. That should ensure @vspinu Any thoughts from you? |
I originally thought to do that, but if I understand the current implementation correctly, the inspector buffer is recreated on each inspect. So there are no per-sesion inspector buffers that we can attach the session to. Not sure if we need them either. |
@@ -134,6 +134,11 @@ This is used as an alternative to the built-in `last-command'. Whenever we | |||
invoke any command through \\[execute-extended-command] and its variants, | |||
the value of `last-command' is not set to the command it invokes.") | |||
|
|||
(defvar cider-inspector--current-repl nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should should probably be a buffer-local variable for the inspector buffers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be wrong, but the inspector buffer is not retained between actions. At least, when I try to change a buffer-local variable, it is set back to nil
once I do push/pop/whatever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, well, this part of the codebase is pretty bad and needs a general cleanup. :-) I keep forgetting it's "special" compared to the rest of the code. No need for additional changes now, but generally we should be reusing the buffer most of the time instead of re-creating it all the time.
Yeah, that's a good point as well. I've added one small inline remark. You should also mention this bugfix in the changelog. |
0cc4c45
to
23a8a12
Compare
This looks like the right approach to me as well. If I understand correctly inspector is really attached to a single connection and not a session. There is also a possibility that the REPL is killed in the meanwhile and I don't think there is a provision to kill the inspector with it. A more generic |
Thank you! |
Double-checked the snapshot from MELPA just in case – it works 🎉 |
Whenever you have more than one connected REPL, and you use the inspector in one of them, the initial value is displayed correctly, but the subsequent actions (push, pop, change page) show something completely off.
Turns out, the inspector buffer does not know the correct REPL where it was initiated from, so
(cider-current-repl)
can return a different REPL where the inspector middleware, obviously, doesn't match.I've been suffering from this problem for quite a while, but only now got annoyed enough to tackle it. I don't know if this is the best solution; but since the current inspector does not allow multiple concurrent inspections for different REPLs, this should work.