DEV Community

Cover image for Introducing VS Code Working Sets 💼
Bernardo Pacheco
Bernardo Pacheco

Posted on

Introducing VS Code Working Sets 💼

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

Top comments (18)

Collapse
 
briand91 profile image
Brian Duggan

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!

Collapse
 
bernardop profile image
Bernardo Pacheco

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

Collapse
 
briand91 profile image
Brian Duggan

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!

Thread Thread
 
bernardop profile image
Bernardo Pacheco

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.

Collapse
 
briandesousa1 profile image
Brian De Sousa

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

Collapse
 
bernardop profile image
Bernardo Pacheco

Awesome! Please do let me know how it goes 😀

Collapse
 
briandesousa1 profile image
Brian De Sousa

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

Collapse
 
reefhound profile image
reefhound

Found this, just what I was looking to create sets of files I need to work on different pages. Especially when inheriting a project with a disorganized folder structure. Now I can have my routing modules in one place.

One little issue. After painstakingly creating filesets for a project, we completed phase 1 and moved to phase 2, but a different project and repo. Almost the same file and folder structure. How can I most easily copy my working sets to the new project?

Collapse
 
themobiledev profile image
Chris McKay

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

Collapse
 
mh_shifat profile image
5hfT

Its awesome

Collapse
 
ganonbit profile image
Andrew Reese

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

Collapse
 
bernardop profile image
Bernardo Pacheco

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.

Collapse
 
ganonbit profile image
Andrew Reese • Edited

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.

Thread Thread
 
bernardop profile image
Bernardo Pacheco

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.

Collapse
 
dgiulian profile image
Diego Giuliani

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

Collapse
 
wazakaunda profile image
waza-kaunda

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

Collapse
 
speedstream profile image
Aaron Santos

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.

Collapse
 
bernardop profile image
Bernardo Pacheco

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