DEV Community

Cover image for VSCode Live Share: Pair programming done right
Steven Straatemans
Steven Straatemans

Posted on

VSCode Live Share: Pair programming done right

Two heads are better than one.
That is why pair-programming is a big thing in certain companies. Some teams really thrive on it and get great results.
Me? I'm not a big fan of it. I never got used to sitting with 2 people behind one desk. The driver typing and the navigator trying to explain what they think should be changed. The latter getting more frustrated by the minute with the former. Pointing furiously at the screen where they want the changes in the code. Finally shoving the other person aside and type what they think works. Or just walking away and writing the code behind their own desk.

Muppets Statler and Waldorf doing the pair programming

The last year, working from home, pair programming was even harder. You had to do it via a screen share. It is harder to make your point when you are not in control and can't point at the screen.
The only upside is that it's easier to scream in silence. Just mute your microphone. Again, this could just be me and my lack of communication skills. Sometimes the preconceptions about developers are real.


I was today years old when I found out about VSCode Live Share. And it was just shy of a religious experience.

Today I had an issue getting Typescript to play nicely with some RxJS. I asked a colleague to have a look. So I thought we could do a screen share. I was dreading it a little, but I wasted to much time already with this issue and my colleague is really good in explaining stuff, so why not.
Instead of asking me to share my screen, the default opening line for every pair programming session via Slack, they suggested to use Live Share in Visual Code.

What is this Live Sharing thing?

If this is your response as well, then keep reading.

Live share is a plugin from Microsoft, the creators of VSCode as you might know. It enables you to collaboratively edit and debug with others in real time.

To start it up is really simple.
All I had to do was install Live Share in Visual Studio Code and all was revealed. It took 1 minute. After installation I sent an invite to my colleague with their Microsoft account, share the generated link and that was it.

A couple of seconds later I saw an extra cursor appear, with the name of my colleague. In my code! And they could do whatever they wanted. They made changes in the code. At the same time I could make changes in the code. In the same file!

Working together in the same editor

It just blew my mind. Of course it could be that I have been living under a rock for the last 3 years and every developer knows about this little gem already. If that is the case, so sorry to waste your time.

The brilliant thing is, it's not like a screen share whatsoever. My colleague was working in their own VSCode, with their own plugins, their own settings, but within my environment and my code. They could be using a light theme for all I cared (I don't know why one would ever want to burn holes in their retina, but they could!)

This is the way pair-programming should be. You shouldn't have to explain to someone what they should do. And be annoyed when that person doesn't understand directly what you mean.
Not everybody has the communicative qualities to explain to others what they need to do. I admire those who can.
Now you can just type your code and the other person can react to that.

It's not just useful for pair-programming. But just think how useful it would be teaching someone a programming concept with this tool.

And it gets better. Apparently I only used the basic features. But there is so much more.

  • You can share a server where both users can start the app via localhost.
  • You can share a terminal.
  • You can limit the files your collaborators have access to.
  • You can follow an other user when they are trying to explain something. So that your screen will scroll when they scroll.

And it's fully extendable with some extra plugins to enrich the experience.
Like:

  • Live Share audio: talk with each other
  • Live Share whiteboard: If you need to explain something, just draw it on the whiteboard

Why didn't anybody tell me about this? Really?! I have been using VSCode for I don't know how long. I searched for the best plugins to help me to be more productive. You know those articles telling you "The top 10 VSCode plugins you can't live without" or "20 Best VSCode Extensions To Improve Your Productivity".
None of them EVER told me about this one.
I'm blaming my colleagues (haha, not really or am I 🤔). This should have come up during one of our many meetups at the company I work for.
So this little write up is for all my colleagues who didn't know about this little gem. There was at least 1, I checked.
Or any other developer who stumbles upon this post

There is so much more to VsCode Live Share, but this post is not meant as a tutorial. I just wanted sing praise and to spread the word about this amazing tool.

Discussion (1)

Collapse
joppe profile image
Joppe Aarts

Good tip Steven! Definitely gone try this soon.