Skip to content

Commit da5808d

Browse files
committed
Fix the debugger's O (force step-out) key
Pressing `O` in a debug session sent a `:force-out` command, but the middleware has no such command: force-out is `:out` sent with a `force?` flag. The unknown command aborted the session and raised an error. Map the `O` key to the `out` command so the uppercase-key force handling in `cider-debug-mode-send-reply' produces a proper forced `:out`, which matches what the menu and `cider-debug-force-out` already send.
1 parent a0f7996 commit da5808d

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
### Bugs fixed
4747

48+
- Fix the debugger's `O` (force step-out) key, which aborted the session with an error because it sent an invalid `:force-out` command instead of a forced `:out`.
4849
- Fix the debugger's menu-bar menu: it advertised the wrong key for "Inject value" (`i` instead of `j`) and was missing entries for stepping in, showing the stacktrace, and tracing.
4950
- Fix `cider-log-kill-appender`'s confirmation message, which had the appender and framework names swapped.
5051
- [#4066](https://github.com/clojure-emacs/cider/pull/4066): Jump to the actual source when clicking a stack frame for a top-level anonymous function (the `deftest` shape), instead of landing in `clojure.core/fn` ([#3157](https://github.com/clojure-emacs/cider/issues/3157)).

lisp/cider-debug.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ Can be toggled at any time with `\\[cider-debug-toggle-locals]'."
186186
(?n "next" "next")
187187
(?i "in" "in")
188188
(?o "out" "out")
189-
(?O "force-out" nil)
189+
;; Force-out is not a distinct middleware command: it's `out' sent with a
190+
;; `force?' flag, which `cider-debug-mode-send-reply' adds because the key
191+
;; is uppercase.
192+
(?O "out" nil)
190193
(?h "here" "here")
191194
(?e "eval" "eval")
192195
(?p "inspect" "inspect")

test/cider-debug-tests.el

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,19 @@
260260

261261
(it "send a forced :out for `cider-debug-force-out'"
262262
(cider-debug-force-out)
263-
(expect 'cider-debug-mode-send-reply :to-have-been-called-with ":out" nil t))
263+
(expect 'cider-debug-mode-send-reply :to-have-been-called-with ":out" nil t)))
264+
265+
(describe "cider-debug-mode-send-reply"
266+
(it "sends a forced :out for the uppercase O key, not an invalid :force-out"
267+
;; The middleware has no `:force-out' command; force-out is `:out' with a
268+
;; `force?' flag, keyed off the uppercase letter.
269+
(spy-on 'cider-nrepl-send-unhandled-request)
270+
(let ((last-command-event ?O)
271+
(cider--debug-mode-response (nrepl-dict "key" "the-key")))
272+
(call-interactively 'cider-debug-mode-send-reply)
273+
(let ((request (car (spy-calls-args-for 'cider-nrepl-send-unhandled-request 0))))
274+
(expect (cadr (member "input" request)) :to-equal "{:response :out :force? true}")
275+
(expect (cadr (member "key" request)) :to-equal "the-key"))))
264276

265277
(it "expose every catalog command as a callable command"
266278
;; Every entry in `cider--debug-commands' feeds the menus, so its

0 commit comments

Comments
 (0)