How to enable (and use) persistent remote connection with VSCode/tmux?

Hello I am following the doc on running VSCode using Julia on a remote server, and all is working smoothly except I can’t keep the session permanent.
I have installed on the server (Ubuntu 20.04) tmux and set the option Persistent session: enabled on the remote window of VSCode but the session seems to be lost when I disconnect and reconnect.
Am I supposed to do something after I reconnect to the server to get back the detached session ?

1 Like

ok, I think I got it… in VSCode remote I opened a normal terminal and typed tmux attach.
The workspace was still empty, but is was enough to evaluate a single command to get it back in full, thank you!

If this is the way it is supposed to work, you could add a note on the documentation, as this last passage is missing…

Just open a new REPL session again, as per usual – we’ll automatically attach to the tmux session originally started.

Ah, thanks. Just to be sure, to “open a new Julia REPL session” normally I just start evaluating something in the file and Julia “starts”, are there other ways to start/reconnect Julia REPL to existing sessions ?
Also, sometimes I need to kill Julia and restart it. If I do it (CTRL+d) in the remote “persistent” session I get a message “Pane is dead” and then I need to open a new bash terminal and type tmux kill-server.
Is this the way to do it ?
Finally, if I try to scroll the persistent terminal panel, instead of the old terminal lines I get the current prompt changing to the history of commands. Again, is there a way to get it scrolling like in the local terminal ?
Thank you

BDW, this is cool! Even better than using R-Studio server on a browser, very different approach…

Just do whatever you do normally, all methods to open a new REPL should reconnect automatically.

Alt-J Alt-K will kill the Julia process and ask you whether you want the tmux session to close as well. Otherwise you should be able to close the dead pane with Ctrl-B X Y too.

Enable mouse mode in tmux by putting set -g mouse on into your ~/.tmux.conf.

3 Likes