In the Live Share extension of VS Code, can users that joined a session run shared code in their own terminal?

239 Views Asked by At

In VS Code's Live Share extension I want it so that participants can join a session and execute code in their individual terminals.

1

There are 1 best solutions below

0
starball On

I suppose one approach could be to set up SSH. Then you as a participant would additionally SSH your integrated terminal to their machine. The host would need to trust you a lot since they'd be giving you a great deal of access to their machine. And when you'd run commands in that SSH connection, the commands would be running on the host machine, and simply sending the output back to you through the SSH connection, so I don't think this wouldn't work for GUI programs. But at that point, I think you'd better just have the host allow for read-write terminals and create a terminal session in their VS Code instance just for you (it wouldn't really be "their own terminal", since it would be completely hosted by the Live Share host). It would have roughly the same limitations I think, and be simpler to set up. See https://learn.microsoft.com/en-us/visualstudio/liveshare/use/share-server-visual-studio-code#share-a-terminal.

Another approach would be to set up something like FTP / some sort of file transfer connection, and then you'd keep fetching changes to your local filesystem and then run things from your own filesystem. Not sure how that'd work for programs with native code and different architecture/platform between host and participant- you'd probably need to do the builds on your own machine instead of "reusing" them from the host. Also not sure how this would work for symlinks/hard-links (Ex. if the project uses PNPM- in which case you'd probably just not fetch the dependencies and just fetch the dependencies manually on your own machine)