I am trying to capture the Pluto URL programmatically ’ pluto_url = some code’ without auto-open and afterwards opening it inside VS Code. Is it possible?
using Pluto
# Start Pluto
@async Pluto.run(; autoopen=false)
# Capture the Pluto URL ensuring the secret token is included
pluto_url = some code
# Pluto uses VS Code’s internal browser in a new tab
@async run(`code --reuse-window "$pluto_url"`)
I don’t know how to open a web page in VS Code from the command line. I don’t normally use VS Code, so I was trusting your run expression worked. I looked into it a bit, but I couldn’t find anything. What does:
code https://www.google.com/
do for you? I get an empty tab and not the SimpleBrowser tab I was hoping for.
Regarding t = @async Pluto.run(session)
If you’re running this as a script outside of the REPL, put a wait(t) at the end. Otherwise, the script will exit and the Pluto server will stop.
While VSCode can open urls using the integrated SimpleBrowser extension, it does not seem like there is an easy/official way of executing commands provided by VSCode extension directly using the VSCode cli from the command line.
See for example these links from stackoverflow: [1], [2]