As a programmer, have you ever felt the need to collaborate with someone in real time on the same codebase? Or maybe you've experienced the pain of setting up an environment on your teammate's computer, trying to explain your thought process, or dealing with merge conflicts. If you can relate, then you'll be excited to hear about the Live Share extension.
My Personal Experience 🔍
I was working on a simple shell project with my partner, and we both had different schedules. We tried to work around this by passing code back and forth, but this wasn't efficient. I searched for a solution and came across the Live Share extension. It's been a game-changer ever since.
What is Live Share? 🤝
Live Share is a Microsoft Visual Studio Code extension that enables you to collaborate with other programmers in real time. You can share your code, terminal, and server with other programmers, regardless of their location. The extension works with any programming language, and it's available on Windows, macOS, and Linux.
How Live Share Works and Benefits 📈
Live Share allows you to share your code and collaborate in real time with other programmers. It has a lot of features that make collaboration easy, including:
Share Code 🤝
You can share your code with other programmers, allowing them to edit and debug the code in real time. This feature is particularly useful for pair programming, where two programmers work together on the same codebase.
Share Terminal 📟
Live Share also lets you share your terminal with other programmers, allowing them to run commands and see the output in real time. This feature is handy for debugging, testing, and running server applications.
How to Use Live Share for Code and Terminal Sharing 💻
Collaborating on code and terminal sharing with Live Share is incredibly convenient, especially for remote pair programming. Follow the steps below to get started:
- Install the Live Share Extension 🚀
To begin, you need to have the Live Share extension installed in your Visual Studio Code (VS Code) editor. Go to the VS Code marketplace and download the extension.
- Open the File and Start a Session 🌟
Once you have installed the extension, open the file that you want to share. Next, click on the "Live Share" button located in the lower-left corner of the editor.
Select "Start collaboration session" to share your code and terminal.
- Share the Session Link 🔗
After starting the session, a unique link will be generated that you can share with your collaborators. Share the link via your preferred communication channel, such as email or chat.
- Joining a Session 🤝
To join the session, your collaborator(s) just need to click on the link and follow the instructions. Once they join, they will be able to see the code you are working on and interact with it in real time. They will also be able to see your cursor, which will enable them to follow along with your work easily.
- Sharing the Terminal 🔍
Initially, the terminal is not shared. However, you can easily share it by clicking on the "Share Terminal" button located in the Live Share panel. Once you share the terminal, your collaborators can see it and interact with it in real time. This makes it easy to debug and troubleshoot issues together.
Problems I Faced 🙁
One issue I faced was committing and pushing code to GitHub. The commit was always attributed to my name, and my partner didn't get credit for their work. I found a workaround by using shell scripting to create a script that sets the Git config for each contributor and commits using their name. I'll write more about this in my next article.
Live Share is an excellent extension for remote pair programming, making collaboration much easier and more efficient. By following the steps above, you can easily share your code and terminal with your collaborators and start working together in real time. With Live Share, working remotely no longer feels so isolating! 🤗