A VS Code Extension for Managing Profiles

Friday, Jun 28, 2019 2 minute read Tags: vscode
Hey, thanks for the interest in this post, but just letting you know that it is over 3 years old, so the content in here may not be accurate.

Part of my job as a Cloud Developer Advocate is to present, whether that is at a lunch and learn session, a user group, a conference or a screen cast. One thing that’s become second nature to me with presenting is tweaking my editor font size, theme, etc. so that it is optimal for the audience. But this becomes a bit tedious, because I then have to go back and undo all my changes again and the constant change back and forth is annoying.

So with that I decided to create an extension for VS Code called Profile Switcher.

Profile Switcher in action

How It Works

When you save a profile with the extension it will create a copy of the settings.json file that exists for your user (on Windows this is %APPDATA%\Roaming\Code\User\settings.json) and then store it in the settings.json file in settings property that the extension knows about.

Side note: It doesn’t clone the extension settings, just everything else, wouldn’t want you to have recursive settings saved! 🤣

Then when you load the a profile it will merge your current settings.json with the previously saved one, updating the properties that are different (and not touching the ones that didn’t change). Because it updates your user settings.json all open VS Code instances will have the changes applied, handy if you’re running demos across multiple VS Code instances!

A nifty side-effect of how this works is that if you’re using the Settings Sync extension your profiles will be synchronised with that, so when you jump between machines you can bring your profiles along with you!

This also means that it’s not just for presenting, it’s for any scenario where you might want to quickly jump between settings changes in VS Code.

Conclusion

I hope you find this extension useful and I’ve love to get some feedback on what it could also be used for. I’ve made the code available on GitHub so you can create an issue for me or propose an update. 😁