Show plots in internal VS Code plot pane

With this change, when Gnuplot.jl is used within VSCode, the plot
shows in VSCode plot pane instead of in a separate Gnuplot window.

Note that when compared to IJulia and Juno, we do not test for active
VS Code connection. I don't think it is necessary, but if it turns out
to be needed later, it can be done with

    isopen(VSCodeServer.conn_endpoint[])
This commit is contained in:
Michal Sojka 2021-03-30 19:21:50 +02:00
parent bc74aa0db4
commit f2ef5373b0
2 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,7 @@
[![DocumentationStatus](https://img.shields.io/badge/docs-stable-blue.svg?style=flat)](https://gcalderone.github.io/Gnuplot.jl/v1.3.0/)
**Gnuplot.jl** is a simple package able to send both data and commands from Julia to an underlying [gnuplot](http://gnuplot.sourceforge.net/) process. Its main purpose it to provide a fast and powerful data visualization framework, using an extremely concise Julia syntax. It also has automatic display of plots in both Jupyter and Juno.
**Gnuplot.jl** is a simple package able to send both data and commands from Julia to an underlying [gnuplot](http://gnuplot.sourceforge.net/) process. Its main purpose it to provide a fast and powerful data visualization framework, using an extremely concise Julia syntax. It also has automatic display of plots in Jupyter, Juno and VS Code.
## Installation

View File

@ -236,11 +236,12 @@ const sessions = OrderedDict{Symbol, Session}()
const options = Options()
function __init__()
# Check whether we are running in an IJulia, Juno or Pluto session.
# Check whether we are running in an IJulia, Juno, VSCode or Pluto session.
# (copied from Gaston.jl).
options.gpviewer = !(
((isdefined(Main, :IJulia) && Main.IJulia.inited) ||
(isdefined(Main, :Juno) && Main.Juno.isactive()) ||
(isdefined(Main, :VSCodeServer)) ||
(isdefined(Main, :PlutoRunner)) )
)
end