Skip to content

Commit

Permalink
Identify REPL input frames as such
Browse files Browse the repository at this point in the history
  • Loading branch information
hlship committed Jan 7, 2016
1 parent af94f03 commit cd7fd37
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Improved docstrings for ANSI font constants and functions.
Added support for invokePrim() stack frames.
These are hidden as with Clojure 1.8 invokeStatic() frames.

Stack frames that represent REPL input now appear as `REPL Input` in the file column, rather than
something like `form-init9201216130440431126.clj`.

Source files with extension `.cljc` (introduced in Clojure 1.7) are now recognized as Clojure code.

**Incompatible change:** write-binary now expects an optional map (not a varargs of keys and values)
Expand Down
19 changes: 14 additions & 5 deletions src/io/aviso/exception.clj
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,16 @@
is-clojure? (->> file-name extension (contains? clojure-extensions))
names (if is-clojure? (convert-to-clojure class-name method-name) [])
name (str/join "/" names)
line (-> element .getLineNumber)]
{:file (strip-prefix file-name-prefix file-name)
:line (if (pos? line) line)
; This pattern comes from somewhere inside nREPL, I believe
[file line] (if (re-matches #"form-init\d+\.clj" file-name)
["REPL Input"]
[(strip-prefix file-name-prefix file-name)
(-> element .getLineNumber)])]
{:file file
; line will sometimes be nil
:line (if (and line
(pos? line))
line)
:class class-name
:package (if (pos? dotx) (.substring class-name 0 dotx))
:is-clojure? is-clojure?
Expand Down Expand Up @@ -432,8 +439,10 @@
(c/write-rows writer [:formatted-name
" "
(:source *fonts*)
:file
[#(if (:line %) ": ") :left 2]
#(if (:line %)
(str (:file %) ":")
(:file %))
" "
#(-> % :line str)
[format-repeats :none]
(:reset *fonts*)]
Expand Down

0 comments on commit cd7fd37

Please sign in to comment.