Skip to content

Commit

Permalink
Remove module info from the error overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
vemv committed Oct 15, 2023
1 parent 599a67c commit dbb641e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### Changes

- [#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).`.
- Remove module info from the [CIDER error overlay](https://docs.cider.mx/cider/usage/dealing_with_errors.html#configuration).
- Example stirng 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')`

## 1.8.2 (2023-10-15)

Expand Down
17 changes: 17 additions & 0 deletions cider-eval.el
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,21 @@ lol in this context, compiling:(/foo/core.clj:10:1)\"
\"Syntax error compiling at (src/workspace_service.clj:227:3).\"
\"Unexpected error (ClassCastException) macroexpanding defmulti at (src/haystack/parser.cljc:21:1).\"")

(defconst cider-module-info-regexp
(rx " ("
(minimal-match (one-or-more anything))
" is in"
(minimal-match (one-or-more anything)) ;; module or unnamed module
" of loader "
(minimal-match (one-or-more anything))
"; "
(minimal-match (one-or-more anything))
" is in "
(minimal-match (one-or-more anything)) ;; module or unnamed module
" of loader "
(minimal-match (one-or-more anything))
")"))

(defvar cider-compilation-regexp
(list cider-clojure-compilation-regexp 2 3 4 '(1))
"Specifications for matching errors and warnings in Clojure stacktraces.
Expand Down Expand Up @@ -844,6 +859,8 @@ when `cider-auto-inspect-after-eval' is non-nil."
(trimmed-err (thread-last err
(replace-regexp-in-string cider-clojure-compilation-regexp
"")
(replace-regexp-in-string cider-module-info-regexp
"")
(string-trim))))
(cider--display-interactive-eval-result
trimmed-err
Expand Down
11 changes: 11 additions & 0 deletions test/cider-error-parsing-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,14 @@
(expect (progn (string-match cider-clojure-compilation-regexp clojure-1.10-compiler-error)
(match-string 2 clojure-1.10-compiler-error))
:to-equal "src/haystack/parser.cljc"))))

(describe "cider-module-info-regexp"
(it "Matches module info provided by Java"
(expect " (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IObj is in unnamed module of loader 'app')"
:to-match cider-module-info-regexp)
(expect " (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IObj is in module java.base of loader 'bootstrap')"
:to-match cider-module-info-regexp)
(expect " (java.lang.Long is in unnamed module of loader 'app'; clojure.lang.IObj is in module java.base of loader 'bootstrap')"
:to-match cider-module-info-regexp)
(expect " (java.lang.Long is in unnamed module of loader 'app'; clojure.lang.IObj is in unnamed module of loader 'app')"
:to-match cider-module-info-regexp)))

0 comments on commit dbb641e

Please sign in to comment.