branch: elpa/cider commit b83c997ec2473254f97e8754c217ce2d485b9d33 Author: vemv <v...@users.noreply.github.com> Commit: vemv <v...@users.noreply.github.com>
Remove module info from the error overlay --- CHANGELOG.md | 2 ++ cider-eval.el | 17 +++++++++++++++++ test/cider-error-parsing-tests.el | 11 +++++++++++ 3 files changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 956b811a76..6e602a3cbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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')` ## 1.8.2 (2023-10-15) diff --git a/cider-eval.el b/cider-eval.el index 2f7745d6d6..9e4206ba0d 100644 --- a/cider-eval.el +++ b/cider-eval.el @@ -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. @@ -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 diff --git a/test/cider-error-parsing-tests.el b/test/cider-error-parsing-tests.el index d53e823d53..72c4fb9ef2 100644 --- a/test/cider-error-parsing-tests.el +++ b/test/cider-error-parsing-tests.el @@ -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)))