loading...
Cover image for Introducing VS Code Working Sets 💼

Introducing VS Code Working Sets 💼

bernardop profile image Bernardo Pacheco ・2 min read

Picture this, you're happily coding an awesome feature for your product and you have a few VS Code tabs open specific to that feature. Suddenly, you receive a message, there is a bug in a totally unrelated part of the site and you need to investigate. You start opening new files as you debug the issue, next thing you know you have 37 tabs open. You fixed the bug (nice job!), but now you want to go back to your awesome feature and there's a lot of clutter, you start closing one-by-one the unrelated tabs until your editor is back to the state it was before the bug.

Does that sound familiar? Have you ever been in that situation before? Wouldn't it be nice if you could "save" the files related to your awesome feature, work on your bug, and then come back to your saved files with just a few clicks?

Well, I wrote a VS Code extension that allows you to do just that. I call it Working Sets.

What are Working Sets?

The idea is simple--a way to manage and organize groups of resources--but is not new. Other editors like Eclipse and Facebook's Nuclide offer versions of this concept. The VS Code team has discussed this before too. And although they may offer a baked-in solution in the near future, I still wanted to share my take on it. I've wanted to contribute to open source for a while and I thought this was the perfect opportunity.

How does it work?

VS Code Working Sets demo

In a nutshell, it shows a new sidebar view where you'll have access to all your saved working sets. From there you can create, restore and delete them as well as add/remove files from them. You can find more details on the extension README.

I would love for you to take it for a spin and let me know what you think.

VS Code Working Sets


Cover photo by Russ Ward

Discussion

markdown guide
 

It's almost like an extended functionality added on top of git stash, but now you get to restore the active tabs as well instead of just the line changes to the files themselves. Cool stuff!

 

Haha when I was telling a teammate about the idea, he replied “oh, like git stash on steroids”.

 

Yeah. I suppose with VSCode you could accomplish the same thing with just git stash, when you apply the stash then the list of those files will appear in the version control sidebar, but that's kind of janky whereas this allows more precise control. Kudos for writing the extension!

Also, imagine you have a file open that you haven't modified, you have it open just because you're referencing things from there. That file would not show up in git stash. With the extension you can add those files as well.

 

Love this idea! Well done. I'm going to try this out tonight.

 

Awesome! Please do let me know how it goes 😀

 

Finally got a chance to install it and try it out. Works great! No issues. Nice clean, simple experience. Thanks for building this!

 

Awesome love the idea. I'll give it a try.

 
 

That's an amazing Idea. I'll check it out. Thanks

 

Would be cool to somehow manage these by git commit/branches too.

 

Can you expand a little on what you mean? Sounds interesting, I haven't looked into VS Code's extension API regarding version control, but maybe they provide some events after certain git actions where I can hook into.

 

I usually do feature branches, and especially as a lead I can be switching between branches often checking others work. So it would be amazing if the sets would change when the branch changes. Especially if that branch touches multiple hands then they get exactly what context needs focus

Of course some way of doing that per commit would be cool, but would be a lot of setup on the user side too. So I think branch based would be more realistic/useful.

I've made a note to look into this. I like the idea of (optionally) associating a working set to a git branch and auto-open it when you switch to that branch.

 

Looks good. I'll give it a try tomorrow.

 

Dude, this is amazing! I spent a lot of time organizing my tabs by working on different ideas and projects at the same time, for me works fantastic.

 

Thanks! I’m glad somebody else finds it useful 🎉