Skip to content

cider-ns: jump to file/line on errors #3626

Closed
@vemv

Description

@vemv

It would be handy if cider-ns jumped to the culprit file/line on errors, so that the user can fix the error and retry.

(Note that the culprit error may not be in an open buffer. Also, if the culprit is in a .jar, probably it's not worth visiting as it may be a wrong diagnostic).

This is a sample refresh response currently:

{:id "0a8f0873-bce2-4d11-826a-906c32ba41d3",
 :reloading ["cider.broken-test-ns"],
 :session #{"9542be41-dc08-4926-99d2-13b68a90ef74"},
 :error
 [{:path "cider/broken_test_ns.clj",
   :file "cider/broken_test_ns.clj",
   :phase "read-source",
   :file-url
   "file:/Users/vemv/cider-nrepl-upstream/broken-refresh-dirs/cider/broken_test_ns.clj",
   :column 6,
   :line 4,
   :class "clojure.lang.Compiler$CompilerException",
   :stacktrace [,,,],
   :compile-like "false",
   :location
   #:clojure.error{:column 6,
                   :line 4,
                   :phase "read-source",
                   :source "cider/broken_test_ns.clj"},
   :message
   "Syntax error reading source at (cider/broken_test_ns.clj:4:6).",
   :data
   "{:clojure.error/phase :read-source, :clojure.error/line 4, :clojure.error/column 6, :clojure.error/source \"cider/broken_test_ns.clj\"}"}
  {:class "java.lang.RuntimeException",
   :compile-like "false",
   :message "Invalid token: :::",
   :phase [],
   :stacktrace
   [,,,]}],
 :error-ns "cider.broken-test-ns",
 :status #{"error" "done"},
 :err
 "Syntax error reading source at (cider/broken_test_ns.clj:4:6).\nInvalid token: :::\n"}

So, we can grab the first valid :file-url / :line combination from :error.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions