clojure-emacs / orchard

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

Inspector - Cons it not printed like other sequentials? #268

Open vemv opened 4 months ago

vemv commented 4 months ago

Below there's an inspected Atom of Cons, the problem being that all its 3 items are rendered into the same line:

Class: clojure.lang.Atom

--- Deref:
  Class: clojure.lang.Cons

  --- Contents:
    ({:instant Wed May 08 00:18:29 CEST 2024, :level :error, :file "xxx_api/middleware.clj", :ns "xxx-api.middleware", :line 118, ...} {:RESULT 42} {:D 42})

I'm fairly sure that in the past it was one line per item.

Thoughts? @alexander-yakushev

vemv commented 4 months ago

False alarm - if I go down, I see the usual structure

Class: clojure.lang.Cons

--- Contents:
  0. {:instant Wed May 08 00:18:29 CEST 2024, :level :error, :file "xxx/middleware.clj", :ns "xxx-api.middleware", :line 118, ...}
  1. {:RESULT 42}
  2. {:D 42}

...The thing that threw me off is that in the previous screen, output was pretty long.

Would there be a drawback to render the same data in "0. 1. 2." format while inspecting the atom?

It's a bit redundant (since then two screens would have nearly the same content) but on the other hand, we keep things readable at all times.

alexander-yakushev commented 4 months ago

This happens because Cons does not implement clojure.lang.Counted, so the inspector does not know its length ahead of time and resorts to printing it the "safe way" instead of expanding it.

It is possible to always try to get one page worth of items even for uncounted collections. That would require some rewriting though.