Skip to content

Commit d346f3e

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

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

CHANGELOG.md

+1
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

+10-12
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ 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+
;; Expand all exception causes to "detail level 1" by default, meaning they
213+
;; will show the message and the data (but not the stacktrace).
214+
(setq-local cider-stacktrace-cause-visibility (make-vector 10 1))
213215
(buffer-disable-undo))
214216

215217

@@ -707,8 +709,7 @@ This associates text properties to enable filtering and source navigation."
707709
(put-text-property p1 p4 'font-lock-face 'cider-stacktrace-ns-face)
708710
(put-text-property p2 p3 'font-lock-face 'cider-stacktrace-fn-face)
709711
(put-text-property (line-beginning-position) (line-end-position)
710-
'cider-stacktrace-frame t)))
711-
(insert "\n")))))))
712+
'cider-stacktrace-frame t)))))))))
712713

713714
(defun cider-stacktrace-render-compile-error (buffer cause)
714715
"Emit into BUFFER the compile error CAUSE, and enable jumping to it."
@@ -844,41 +845,38 @@ make INSPECT-INDEX actionable if present."
844845
,cider-stacktrace-exception-map)
845846
(insert (format "%d. " num)
846847
(propertize note 'font-lock-face 'font-lock-comment-face) " "
847-
(propertize class 'font-lock-face class-face 'mouse-face 'highlight)
848-
"\n"))
848+
(propertize class 'font-lock-face class-face 'mouse-face 'highlight)))
849849
;; Detail level 1: message + ex-data
850850
(cider-propertize-region '(detail 1)
851+
(insert "\n")
851852
(if (equal class "clojure.lang.Compiler$CompilerException")
852853
(cider-stacktrace-render-compile-error buffer cause)
853854
(cider-stacktrace-emit-indented
854855
(propertize (or message "(No message)")
855856
'font-lock-face message-face)
856857
indent t))
857-
(insert "\n")
858858
(when spec
859+
(insert "\n")
859860
(cider-stacktrace--emit-spec-problems spec (concat indent " ")))
860861
(when data
862+
(insert "\n")
861863
(cider-stacktrace-emit-indented data indent nil t)))
862864
;; Detail level 2: stacktrace
863865
(cider-propertize-region '(detail 2)
864-
(insert "\n")
865866
(let ((beg (point))
866867
(bg `(:background ,cider-stacktrace-frames-background-color :extend t)))
867868
(dolist (frame stacktrace)
869+
(insert "\n")
868870
(cider-stacktrace-render-frame buffer frame))
869871
(overlay-put (make-overlay beg (point)) 'font-lock-face bg)))
870872
;; Add line break between causes, even when collapsed.
871873
(cider-propertize-region '(detail 0)
872-
(insert "\n")))))))
874+
(insert "\n\n")))))))
873875

874876
(defun cider-stacktrace-initialize (causes)
875877
"Set and apply CAUSES initial visibility, filters, and cursor position."
876878
(nrepl-dbind-response (car causes) (class)
877879
(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))
882880
;; Fully display innermost cause. This also applies visibility/filters.
883881
(cider-stacktrace-cycle-cause 1 cider-stacktrace-detail-max)
884882
;; Move point (DWIM) to the compile error location if present, or to the

0 commit comments

Comments
 (0)