Visual Studio Code (VSCode)

note: replace variable starting with $ with actual value

running Live Share on server for collaboration

  1. SSH into server with port forwarding, then run Tmux:

    ssh -L $FORWARD_PORT:localhost:$FORWARD_PORT $USER@$SERVER
    tmux new -s $SESSION_NAME
    

    alternatives to screen would work

  2. run Code Tunnels in Tmux on server. needed to get headless VSCode running on server

    1. download vscode cli and install on server: Download Visual Studio Code - Mac, Linux, Windows

    2. start code tunnel on server, log in, etc.

      code tunnel
      

      follow instruction, get $URL of tunnel

  3. connect to this code tunnel from headless Chrome in Tmux on server, and start Live Share. needed to get persistent session

    1. download chrome and install on server: Google Chrome Web Browser. to do this w/o sudo on debian, only extract the .deb to somewhere you own and symlink into local bin on PATH, something like:

      mkdir $LOCAL_BIN/chrome
      dkpg -x $CHROME_DEB $LOCAL_BIN/chrome
      cd $LOCAL_BIN
      ln -s chrome/opt/google/chrome/google-chrome google-chrome
      
    2. start headless Chrome on server:

      google-chrome --headless=new --remote-debugging-port=$FORWARD_PORT $URL
      
    3. connect headless Chrome from local machine with Chrome DevTools remote debugging. open chrome://inspect/#devices in local Chromium-based browser, click Configure…, put in localhost:$FORWARD_PORT. wait a bit. tab of $URL should appear on this page, click inspect below it to directly interact with web VSCode UI tab

    4. open up chrome console and overwrite clipboard. needed to see Live Share link later because DevTools remote clipboard is fake:

      _writeText = navigator.clipboard.writeText;
      navigator.clipboard.writeText = console.log;
      
    5. start Live Share from UI. open directory in UI, click Live Share button at the bottom to start it, choose log in.

    6. complete login from remote popup tab by going back to chrome://inspect/#devices. (wait a bit). find login tab, complete login

    7. get Live Share link. return to UI tab, Live Share should be on, it should say link copied to clipboard (if not, click bottom Live Share button again to copy again). get link in console as printed out

  4. (optional) to manage Shared Terminals, in the UI, open the Live Share panel in the sidebar. needed for participants to use terminal

  5. use the Live Share link yourself and send it to others. you can close your local browser and SSH connection now. the session remains up as long as your Tmux session on the server is up


Enabling discussion for feedback from people trying this out: