How to make WGLMakie play nice with the vscode's plot pane

With CairoMakie or GLMakie, we can switch between different plots with left/right arrow, but when the backend is set to WGLMakie, this function seems broken?

Usage example could be that, especially with 3d plots, rotating/panning is easier with WGLMakie since it’s in the same vscode window and not in a separate glfw window as in GLMakie, and CairoMakie does not allow rotating 3d plots interactively

There’s a not much documented function in Bonito.jl that keeps the session open:

You can use that to leave the sessions of the last plotpanes open and switch between them… Let me know if it works!

Thanks for the tip! Except for some warning it seems to work,

β”Œ Warning: error while processing received msg
β”‚   exception =
β”‚    Plot initialized multiple times?
β”‚    Stacktrace:
β”‚     [1] error(s::String)
β”‚       @ Base ./error.jl:35
β”‚     [2] (::WGLMakie.var"#4#5"{WGLMakie.Screen, Scene})(initialized::Bool)
β”‚       @ WGLMakie ~/.julia/packages/WGLMakie/AhDKR/src/display.jl:96
β”‚     [3] #invokelatest#2
β”‚       @ ./essentials.jl:1055 [inlined]
β”‚     [4] invokelatest
β”‚       @ ./essentials.jl:1052 [inlined]
β”‚     [5] update_nocycle!(obs::Observable{Any}, value::Any)
β”‚       @ Bonito ~/.julia/packages/Bonito/vh4Oz/src/rendering/observables.jl:42
β”‚     [6] #invokelatest#2
β”‚       @ ./essentials.jl:1055 [inlined]
β”‚     [7] invokelatest
β”‚       @ ./essentials.jl:1052 [inlined]
β”‚     [8] process_message(session::Bonito.Session{Bonito.WebSocketConnection}, bytes::Vector{UInt8})
β”‚       @ Bonito ~/.julia/packages/Bonito/vh4Oz/src/serialization/protocol.jl:36
β”‚     [9] (::Bonito.var"#1#2"{Bonito.Session{Bonito.WebSocketConnection}, Channel{Vector{UInt8}}})()
β”‚       @ Bonito ~/.julia/packages/Bonito/vh4Oz/src/types.jl:251
β”” @ Bonito ~/.julia/packages/Bonito/vh4Oz/src/types.jl:253

seems to come from