Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vemv opened this issue Mar 5, 2024 · 0 comments · Fixed by #3627
Closed

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

vemv opened this issue Mar 5, 2024 · 0 comments · Fixed by #3627
Assignees

Comments

@vemv
Copy link
Member

vemv commented Mar 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants