Skip to content

Commit

Permalink
Add missing case for Clojure 1.10 syntax errors (#3506)
Browse files Browse the repository at this point in the history
Loading a buffer sometimes fails silently, since `cider-handle-compilation-errors` currently does not properly parse all syntax errors.

The pattern matches:

> Syntax error compiling at
> Syntax error macroexpanding at

but needs to also match:

> Syntax error reading source at

This commit fixes this by adding the missing string to the regex.
  • Loading branch information
magnars authored Oct 9, 2023
1 parent 7a49438 commit cd5cbb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cider-eval.el
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ It delegates the actual error content to the eval or op handler."
"Syntax error "
(minimal-match (zero-or-more anything))
(or "compiling "
"macroexpanding ")
"macroexpanding "
"reading source ")
(minimal-match (zero-or-more anything))
"at ("
(group-n 2 (minimal-match (zero-or-more anything)))
Expand Down
2 changes: 2 additions & 0 deletions test/cider-eval-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@
:to-equal '("src/haystack/analyzer.clj" 18 1 cider-error-highlight-face "Syntax error compiling clojure.core/let at (src/haystack/analyzer.clj:18:1).\n[1] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings\n"))
(expect (cider-extract-error-info cider-compilation-regexp "Syntax error macroexpanding clojure.core/let at (src/haystack/analyzer.clj:18:1).\n[1] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings\n")
:to-equal '("src/haystack/analyzer.clj" 18 1 cider-error-highlight-face "Syntax error macroexpanding clojure.core/let at (src/haystack/analyzer.clj:18:1).\n[1] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings\n"))
(expect (cider-extract-error-info cider-compilation-regexp "Syntax error reading source at (/Users/vemv/haystack/src/haystack/parser.cljc:13:0).")
:to-equal '("/Users/vemv/haystack/src/haystack/parser.cljc" 13 0 cider-error-highlight-face "Syntax error reading source at (/Users/vemv/haystack/src/haystack/parser.cljc:13:0)."))
(expect (cider-extract-error-info cider-compilation-regexp "Syntax error FOOING clojure.core/let at (src/haystack/analyzer.clj:18:1).\n[1] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings\n")
:to-equal nil)))

0 comments on commit cd5cbb3

Please sign in to comment.