clojure-emacs / orchard

A fertile ground for Clojure tooling
Eclipse Public License 1.0
326 stars 54 forks source link

Navigable inspected exceptions #227

Open vemv opened 6 months ago

vemv commented 6 months ago

Currently, if we're inspecting an Exception, we cannot directly navigate to the file/line of each element of the rendered stacktrace.

i.e., this stacktrace is just text atm:

image

Currently, a workaround is to d (cider-inspector-def-current-val) the inspected Exception, and then throw it in the repl. cider-stacktrace-analyze-in-region may also work.

I think that something very "inspector-like" would be to reify the stacktrace into something that also is navigable:

vemv commented 4 months ago

@alexander-yakushev a possibly easy subset of this problem is making sure that stacktraces have a reasonable length limit by default.

At the moment (cider-nrepl latest stable) they can create a huge line, slowing down Emacs.

Perhaps it's already fixed (or easy to configure) given the latest additions?

alexander-yakushev commented 4 months ago

We can provide a custom print function for Exceptions that limits the length, or I suggest setting inspector's default newly introduced max-value-limit to something reasonable, 5000 or 10000 (my (* (window-width) (window-height)) is 6000). This will take care of exceptions and any other values that render into something huge and don't honor *print-length*.

vemv commented 4 months ago

Thanks!

I'd go for the latter - seems a generalized fix for an area that could slow down Emacs (so it's reasonable to consider this broken already)


Not sure if max-value-limit can be passed from cider/cider-nrepl, that would be a nice follow-up addition.

alexander-yakushev commented 4 months ago

Not sure if max-value-limit can be passed from cider/cider-nrepl, that would be a nice follow-up addition.

It will be, as new cider-nrepl ops, currently can be seen here: https://github.com/clojure-emacs/cider-nrepl/pull/869.