Skip to content

Commit b83c997

Browse files
committed
Remove module info from the error overlay
1 parent 08a9adf commit b83c997

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
### Changes
66

77
- [#3521](https://github.com/clojure-emacs/cider/issues/3521): Expand `cider-clojure-compilation-regexp` to also match e.g. `Unexpected error (ExceptionInfo) macroexpanding defmulti at (src/ns.clj:1:1).`.
8+
- Remove module info from the [CIDER error overlay](https://docs.cider.mx/cider/usage/dealing_with_errors.html#configuration).
9+
- Example string that is now trimmed away: `(java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IObj is in unnamed module of loader 'app')`
810

911
## 1.8.2 (2023-10-15)
1012

cider-eval.el

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,21 @@ lol in this context, compiling:(/foo/core.clj:10:1)\"
617617
\"Syntax error compiling at (src/workspace_service.clj:227:3).\"
618618
\"Unexpected error (ClassCastException) macroexpanding defmulti at (src/haystack/parser.cljc:21:1).\"")
619619

620+
(defconst cider-module-info-regexp
621+
(rx " ("
622+
(minimal-match (one-or-more anything))
623+
" is in"
624+
(minimal-match (one-or-more anything)) ;; module or unnamed module
625+
" of loader "
626+
(minimal-match (one-or-more anything))
627+
"; "
628+
(minimal-match (one-or-more anything))
629+
" is in "
630+
(minimal-match (one-or-more anything)) ;; module or unnamed module
631+
" of loader "
632+
(minimal-match (one-or-more anything))
633+
")"))
634+
620635
(defvar cider-compilation-regexp
621636
(list cider-clojure-compilation-regexp 2 3 4 '(1))
622637
"Specifications for matching errors and warnings in Clojure stacktraces.
@@ -844,6 +859,8 @@ when `cider-auto-inspect-after-eval' is non-nil."
844859
(trimmed-err (thread-last err
845860
(replace-regexp-in-string cider-clojure-compilation-regexp
846861
"")
862+
(replace-regexp-in-string cider-module-info-regexp
863+
"")
847864
(string-trim))))
848865
(cider--display-interactive-eval-result
849866
trimmed-err

test/cider-error-parsing-tests.el

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,14 @@
142142
(expect (progn (string-match cider-clojure-compilation-regexp clojure-1.10-compiler-error)
143143
(match-string 2 clojure-1.10-compiler-error))
144144
:to-equal "src/haystack/parser.cljc"))))
145+
146+
(describe "cider-module-info-regexp"
147+
(it "Matches module info provided by Java"
148+
(expect " (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IObj is in unnamed module of loader 'app')"
149+
:to-match cider-module-info-regexp)
150+
(expect " (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IObj is in module java.base of loader 'bootstrap')"
151+
:to-match cider-module-info-regexp)
152+
(expect " (java.lang.Long is in unnamed module of loader 'app'; clojure.lang.IObj is in module java.base of loader 'bootstrap')"
153+
:to-match cider-module-info-regexp)
154+
(expect " (java.lang.Long is in unnamed module of loader 'app'; clojure.lang.IObj is in unnamed module of loader 'app')"
155+
:to-match cider-module-info-regexp)))

0 commit comments

Comments
 (0)