Skip to content

Commit 5435c67

Browse files
vspinubbatsov
authored andcommitted
Add "CompilationException" and relax "Warnings" srcloc regexps
1 parent 581471a commit 5435c67

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

cider-repl.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,8 @@ command will prompt for the name of the namespace to switch to."
11641164
(print-stacktrace "\\[\\([^][$ \t]+\\).* +\\([^ \t]+\\) +\\([0-9]+\\)\\]" 0 1 2 3)
11651165
(timbre-log "\\(TRACE\\|INFO\\|DEBUG\\|WARN\\|ERROR\\) +\\(\\[\\([^:]+\\):\\([0-9]+\\)\\]\\)" 2 3 nil 4)
11661166
(cljs-message "at line \\([0-9]+\\) +\\(.*\\)$" 0 nil 2 1)
1167-
(reflection "Reflection warning, +\\(\\([^\n:]+\\):\\([0-9]+\\):[0-9]+\\)" 1 nil 2 3))
1167+
(warning "warning,? +\\(\\([^\n:]+\\):\\([0-9]+\\):[0-9]+\\)" 1 nil 2 3)
1168+
(compilation ".*compiling:(\\([^\n:)]+\\):\\([0-9]+\\):[0-9]+)" 0 nil 1 2))
11681169
"Alist holding regular expressions for inline location references.
11691170
Each element in the alist has the form (NAME REGEXP HIGHLIGHT VAR FILE
11701171
LINE), where NAME is the identifier of the regexp, REGEXP - regexp matching

test/cider-repl-tests.el

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,29 @@ PROPERTY shoudl be a symbol of either 'text, 'ansi-context or
204204
(expect (cider-locref-at-point)
205205
:to-equal
206206
'(:type cljs-message :highlight (54 . 86) :var nil :file "/path/to/aaa/bbb.cljc" :line 42))))
207-
(it "works with reflection warnings"
207+
(it "works with warnings"
208208
(with-temp-buffer
209209
(insert "\nReflection warning, cider/nrepl/middleware/slurp.clj:103:16 - reference to field getInputStream can't be resolved.")
210210
(move-to-column 20)
211211
(expect (cider-locref-at-point)
212212
:to-equal
213-
'(:type reflection :highlight (22 . 61) :var nil :file "cider/nrepl/middleware/slurp.clj" :line 103)))))
213+
'(:type warning :highlight (22 . 61) :var nil :file "cider/nrepl/middleware/slurp.clj" :line 103))))
214+
(it "works with warnings"
215+
(with-temp-buffer
216+
(insert "\nReflection warning, cider/nrepl/middleware/slurp.clj:103:16 - reference to field getInputStream can't be resolved.")
217+
(move-to-column 20)
218+
(expect (cider-locref-at-point)
219+
:to-equal
220+
'(:type warning :highlight (22 . 61) :var nil :file "cider/nrepl/middleware/slurp.clj" :line 103)))
221+
(with-temp-buffer
222+
(insert "\nBoxed math warning, cider/inlined_deps/toolsreader/v1v2v2/clojure/tools/reader/impl/utils.clj:18:9 - call: public static boolean clojure.lang.Numbers.lt(java.lang.Object,long).")
223+
(move-to-column 20)
224+
(expect (cider-locref-at-point)
225+
:to-equal
226+
'(:type warning :highlight (22 . 100) :var nil :file "cider/inlined_deps/toolsreader/v1v2v2/clojure/tools/reader/impl/utils.clj" :line 18))))
227+
(it "works with compilation exceptions"
228+
(insert "\nCompilerException java.lang.RuntimeException: Unable to resolve symbol: pp in this context, compiling:(/path/to/a/file.clj:575:16)")
229+
(move-to-column 20)
230+
(expect (cider-locref-at-point)
231+
:to-equal
232+
'(:type compilation :highlight (2 . 132) :var nil :file "/path/to/a/file.clj" :line 575))))

0 commit comments

Comments
 (0)