Skip to content

Commit 24e31ae

Browse files
[stacktrace] Visual improvements, expand causes by 1 by default
1 parent ee35c30 commit 24e31ae

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [#3782](https://github.com/clojure-emacs/cider/issues/3782): **(Breaking)** Drop official support for Emacs 26.
88
- [#3777](https://github.com/clojure-emacs/cider/issues/3777): Inspector no longer displays parsed Javadoc for Java classes and members.
99
- [#3784](https://github.com/clojure-emacs/cider/issues/3784): Inspector: make point less erratic when navigating between inspector screens.
10+
- [#3790](https://github.com/clojure-emacs/cider/issues/3790): Stacktrace: show messages and data for all exception causes by default.
1011

1112
## 1.17.1 (2025-02-25)
1213

cider-stacktrace.el

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ The error types are represented as strings."
209209
(setq-local electric-indent-chars nil)
210210
(setq-local cider-stacktrace-hidden-frame-count 0)
211211
(setq-local cider-stacktrace-filters cider-stacktrace-default-filters)
212-
(setq-local cider-stacktrace-cause-visibility (make-vector 10 0))
212+
(setq-local cider-stacktrace-cause-visibility (make-vector 10 1))
213213
(buffer-disable-undo))
214214

215215

@@ -687,6 +687,7 @@ This associates text properties to enable filtering and source navigation."
687687
(nrepl-dbind-response frame (file line flags class method name var ns fn)
688688
(when (or class file fn method ns name)
689689
(let ((flags (mapcar #'intern flags))) ; strings -> symbols
690+
(insert "\n")
690691
(insert-text-button (format "%26s:%5d %s/%s"
691692
(if (member 'repl flags) "REPL" file) (or line -1)
692693
(if (member 'clj flags) ns class)
@@ -707,8 +708,7 @@ This associates text properties to enable filtering and source navigation."
707708
(put-text-property p1 p4 'font-lock-face 'cider-stacktrace-ns-face)
708709
(put-text-property p2 p3 'font-lock-face 'cider-stacktrace-fn-face)
709710
(put-text-property (line-beginning-position) (line-end-position)
710-
'cider-stacktrace-frame t)))
711-
(insert "\n")))))))
711+
'cider-stacktrace-frame t)))))))))
712712

713713
(defun cider-stacktrace-render-compile-error (buffer cause)
714714
"Emit into BUFFER the compile error CAUSE, and enable jumping to it."
@@ -844,41 +844,37 @@ make INSPECT-INDEX actionable if present."
844844
,cider-stacktrace-exception-map)
845845
(insert (format "%d. " num)
846846
(propertize note 'font-lock-face 'font-lock-comment-face) " "
847-
(propertize class 'font-lock-face class-face 'mouse-face 'highlight)
848-
"\n"))
847+
(propertize class 'font-lock-face class-face 'mouse-face 'highlight)))
849848
;; Detail level 1: message + ex-data
850849
(cider-propertize-region '(detail 1)
850+
(insert "\n")
851851
(if (equal class "clojure.lang.Compiler$CompilerException")
852852
(cider-stacktrace-render-compile-error buffer cause)
853853
(cider-stacktrace-emit-indented
854854
(propertize (or message "(No message)")
855855
'font-lock-face message-face)
856856
indent t))
857-
(insert "\n")
858857
(when spec
858+
(insert "\n")
859859
(cider-stacktrace--emit-spec-problems spec (concat indent " ")))
860860
(when data
861+
(insert "\n")
861862
(cider-stacktrace-emit-indented data indent nil t)))
862863
;; Detail level 2: stacktrace
863864
(cider-propertize-region '(detail 2)
864-
(insert "\n")
865865
(let ((beg (point))
866866
(bg `(:background ,cider-stacktrace-frames-background-color :extend t)))
867867
(dolist (frame stacktrace)
868868
(cider-stacktrace-render-frame buffer frame))
869869
(overlay-put (make-overlay beg (point)) 'font-lock-face bg)))
870870
;; Add line break between causes, even when collapsed.
871871
(cider-propertize-region '(detail 0)
872-
(insert "\n")))))))
872+
(insert "\n\n")))))))
873873

874874
(defun cider-stacktrace-initialize (causes)
875875
"Set and apply CAUSES initial visibility, filters, and cursor position."
876876
(nrepl-dbind-response (car causes) (class)
877877
(let ((compile-error-p (equal class "clojure.lang.Compiler$CompilerException")))
878-
;; Partially display outermost cause if it's a compiler exception (the
879-
;; description reports reader location of the error).
880-
(when compile-error-p
881-
(cider-stacktrace-cycle-cause (length causes) 1))
882878
;; Fully display innermost cause. This also applies visibility/filters.
883879
(cider-stacktrace-cycle-cause 1 cider-stacktrace-detail-max)
884880
;; Move point (DWIM) to the compile error location if present, or to the

0 commit comments

Comments
 (0)