Why You Should Give VS Code Live Share A Chance:
We’ve all had that feeling before, wanting to yell through your screen, or maybe move a pointer to where your finger is pressing really hard against your screen while your developer partner is having an internal 404 error with their brain (we’ve all been there too 😂😂). All that struggle and frustration just for a lousy semicolon or closing parenthesis. Or maybe its just me… But regardless if you are a senior or junior developer, intern, or just starting out as a developer, I also want to assume that the fear of ruining a working git repo lives within all of us. That being said, there is no avoiding having to do push and pull requests, but there is a way to decrease them if you use Visual Studio Code as your IDE while doing paired programming. Visual Studio Code has countless built-in and add-on features that make our lives as developers more convenient. One of these extensions is called “Live Share” as stated in their details page:
“Visual Studio Live Share enables you to collaboratively edit and debug with others in real time, regardless what programming languages you’re using or app types you’re building. It allows you to instantly (and securely) share your current project, and then as needed, share debugging sessions, terminal instances, localhost web apps, voice calls, and more! Developers that join your sessions receive all of their editor context from your environment (e.g. language services, debugging), which ensures they can start productively collaborating immediately, without needing to clone any repos or install any SDKs.”
If you are still not sure how Live Share works you can compare it to a shared Google Doc, where multiple people have read/write access to a single document and can save changes to that one document. If there are spelling errors or formatting issues, all users would be able to notice it right away. The same features apply to Visual Studio when you are using Live Share.
Initializing a Live Share
If you are the user initiating the Live Share you can begin by making sure that you have the extension installed by navigating to the extensions tab and typing “Live Share” in the search bar. It’s the first option. Upon installing, you will have a new tab on the left-hand side (a circle with an arrow over it) that you can click on to see the “Share” button. Another, quicker method would be at the bottom on your footer bar there is that same icon with the text “Live Share”. Clicking that will automatically begin a share session and copy the secured link to your clipboard. You can then send to the users you want to collaborate with this link.
Joining a Live Share
Once the collaborator receives the link, clicking on it from outside of Visual Studio Code will open a new browser tab asking for permission to open the Visual Studio Code App, and upon opening, VS Code will prompt you to login using GitHub or Microsoft Account. If the collaborator is already in you VS Code contacts, all they have to do is open a VS Code window, you send them the invitation from the contacts tab and they receive a notification directly in VS code that they can click and automatically join. It’s really that easy.
Tip: If you ever miss an invitation at the moment it was received, you can click on the bell icon on the bottom right corner and that will bring up all your notifications.
It’s Seriously That Easy?
YES! Now you and your developer partner(s) are all looking at the same files while updating it simultaneously. Changes made by collaborators will be seen with their assigned color on the scrollbar and their current cursor position will be highlighted on the line they are on (pictured below).
What Else Can I Do?
The best part about this is that you can also share your open terminals and servers (initiated inside VS Code). This means that the collaborators can also view an app you are developing using that shared server, or open up your db.json file and run commands on the shared terminals. Live Share has other add-on extensions that you can install for audio calling within VS Code (I have yet to try this) and chatting inside the Live Share session.
When I found out about the options Live Share had and knowing about my fear of git push/pull requests, I decided to give it a try and have not regret it one bit. I am doing my part by letting my fellow developers know how simple and straightforward using this extension is, all while avoiding those tedious merge conflicts or git pull issues because your branch “Is not up to date”. It’s truly a lifesaver. After this, I hope you’re convinced to install Live Share and give it a chance. Happy coding!