# Structured display for Julia objects

**URL:** <https://discourse.julialang.org/t/structured-display-for-julia-objects/40700>\
**Category:** General Usage\
**Created:** [June 4, 2020, 12:20am UTC](https://discourse.julialang.org/t/structured-display-for-julia-objects/40700 "2020-06-04T00:20:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [June 4, 2020, 12:20am UTC](https://discourse.julialang.org/t/structured-display-for-julia-objects/40700/1 "2020-06-04T00:20:08Z")

</div>

I find the structured display for arbitrary objects in Juno very convenient:

 ![juno](https://global.discourse-cdn.com/julialang/original/3X/0/a/0a2fc75760b3d8f437e6d24b363ba563a41ec2f0.png)

Is there anything similar available for VS Code plugin, Jupyter notebooks or any other Julia IDE? I know about `Base.dump`, but I prefer a GUI equivalent.

On that note, why Juno displays `im` structure as a `Vector` (see above), while REPL shows:

```julia
julia> typeof(im)
Array{MessageData{RobotOSData.CommonMsgs.sensor_msgs.Image},1}

```

I know that `Vector{T}` is equivalent to `Array{T,1}`, which makes Juno’s choice of visualization easier to read.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [June 4, 2020, 9:14am UTC](https://discourse.julialang.org/t/structured-display-for-julia-objects/40700/2 "2020-06-04T09:14:01Z")

</div>

> Is there anything similar available for VS Code plugin, Jupyter notebooks or any other Julia IDE? I know about `Base.dump` , but I prefer a GUI equivalent.

Kinda:

 ![Peek 2020-06-04 11-08](https://global.discourse-cdn.com/julialang/original/3X/9/4/944503ce592ce5b49ed7e00dd8a88792e9884258.gif)

[REPLTreeViews.jl](https://github.com/pfitzseb/REPLTreeViews.jl) provides a TUI, but that package needs a bit of love before I’d really recommend it.

We’ll also implement structured display for the VSCode workspace soon.

> On that note, why Juno displays `im` structure as a `Vector`

Because it’s easier to read 🙂  
There are some efforts underway for Base at

> <https://github.com/JuliaLang/julia/pull/36032>
>
> Personally I find this clearer, especially when types are nested.
> 
> As an examp…le
> 
> \`\`\`
> 1-element Array{Union{X28004, Array{T,1} where T},1}:\\n X(Any\[X(1)\])
> \`\`\`
> 
> vs
> 
> \`\`\`
> 1-element Vector{Union{X28004, Vector{T} where T}}:\\n X(Any\[X(1)\])
> \`\`\`
> 
> Some potential objections:
> 
> \- How about the other array types, \`AbstractVector\`, \`DenseVector\` etc? Could also be special cased imo.
> \- Could potentially hide that \`Vector{T}\` is just another name for \`Array{T, 1}\`. - I feel this is something you learn pretty quickly and the convenience in printing makes up for the slight "pedagogical" issue.

and

> <https://github.com/JuliaLang/julia/pull/36107>
>
> Given triage's interest in https://github.com/JuliaLang/julia/pull/36032, this w…orks to generalize those printing improvements to all types. While type-intersection failures can be rather unexpected (i.e. handling difficult cases, but not simplifications of them), it often does much better than master anyways:
> 
> \`\`\`julia
> julia\> T = Union{Nothing, StridedVector{S}} where S
> Union{Nothing, StridedArray{S,1}} where S
> 
> julia\> T = Union{Nothing, StridedVecOrMat{S}} where S\<:Integer
> Union{Nothing, StridedMatrix{S}, StridedVector{S}} where S\<:Integer
> 
> julia\> T = Union{Nothing, StridedVecOrMat{S}, S} where S\<:Integer
> Union{Nothing, S, StridedMatrix{S}, StridedVector{S}} where S\<:Integer
> 
> julia\> StridedVecOrMat
> StridedVecOrMat{T} where T = Union{DenseArray{T,1}, DenseArray{T,2}, Base.ReinterpretArray{T,1,S,A} where S where A\<:Union{SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray}, Base.ReinterpretArray{T,2,S,A} where S where A\<:Union{SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray}, Base.ReshapedArray{T,1,A,MI} where MI\<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A\<:Union{Base.ReinterpretArray{T,N,S,A} where S where A\<:Union{SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray} where N where T, SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray}, Base.ReshapedArray{T,2,A,MI} where MI\<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A\<:Union{Base.ReinterpretArray{T,N,S,A} where S where A\<:Union{SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray} where N where T, SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray}, SubArray{T,1,A,I,L} where L where I\<:Tuple{Vararg{Union{Int64, AbstractRange{Int64}, Base.AbstractCartesianIndex, Base.ReshapedArray{T,N,A,Tuple{}} where A\<:AbstractUnitRange where N where T},N} where N} where A\<:Union{Base.ReinterpretArray{T,N,S,A} where S where A\<:Union{SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray} where N where T, Base.ReshapedArray{T,N,A,MI} where MI\<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A\<:Union{Base.ReinterpretArray{T,N,S,A} where S where A\<:Union{SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray} where N where T, SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray} where N where T, DenseArray}, SubArray{T,2,A,I,L} where L where I\<:Tuple{Vararg{Union{Int64, AbstractRange{Int64}, Base.AbstractCartesianIndex, Base.ReshapedArray{T,N,A,Tuple{}} where A\<:AbstractUnitRange where N where T},N} where N} where A\<:Union{Base.ReinterpretArray{T,N,S,A} where S where A\<:Union{SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray} where N where T, Base.ReshapedArray{T,N,A,MI} where MI\<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A\<:Union{Base.ReinterpretArray{T,N,S,A} where S where A\<:Union{SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray} where N where T, SubArray{T,N,A,I,true} where I\<:Union{Tuple{Vararg{Real,N} where N}, Tuple{AbstractUnitRange,Vararg{Any,N} where N}} where A\<:DenseArray where N where T, DenseArray} where N where T, DenseArray}} where T
> \`\`\`
> 
> Note: all relevant changes are in \[base/show.jl\](https://github.com/JuliaLang/julia/pull/36107/files#diff-b4267643a238b5a375b3e055817ee6ca)

---

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [June 4, 2020, 5:48pm UTC](https://discourse.julialang.org/t/structured-display-for-julia-objects/40700/3 "2020-06-04T17:48:37Z")

</div>

Thanks a lot for your detailed response. The Julia community really is top-notch!

I’m looking forward to VSCode plugin improvements. Still debating whether to start with Juno and switch to VSCode in a few months or just forgo two learning curves and go straight to VSCode.
