DEV Community

How to Create Code Profiles in VSCode

Joe Previte (he/him) on June 27, 2019

This post piggybacks off of the work done by @avanslaars who is a fellow instructor at egghead.io. He shared this in the egghead Slack sometime ag...
Collapse
 
aaronpowell profile image
Aaron Powell

Nice trick Joe, I created an extension this week to do just that! Profile Switcher allows you to save a bunch of profiles and swap between them from within vscode 😁

Collapse
 
jsjoeio profile image
Joe Previte (he/him)

Woah! Spooky timing - I'll have to check it out and share it with the team at egghead - I'm glad you found my post 😄

Collapse
 
aaronpowell profile image
Aaron Powell

Really 👻!

I was preparing to write a blog about it today on here as well 🤣

Would love to hear what you all think of it and look to collaborate and make it better for everyone.

Thread Thread
 
aaronpowell profile image
Aaron Powell • Edited
Collapse
 
ahmadawais profile image
Ahmad Awais ⚡️

Thanks for sharing this but I messed it up. Was just trying to see how this works quickly — to answer a question on Twitter and the command code --user-data-dir is potentially destructive. I opened on my desktop and now there are a whole bunch of files there as well as that the article mentions nothing about going back and what was the default user directory?

My normal VSCode setup is all broken now. Looks like that VSCode is still using Desktop as the user directory instead of whatever was the normal default and I have no idea what was that.

Truly lost here. :(

Kindly, mention in your article that the command is potentially destructive.

Collapse
 
ahmadawais profile image
Ahmad Awais ⚡️

OK. So, it looks like you have to open VSCode with a simple code command for it to reset the user directory — where ever it is set to default since the docs certainly don't mention anything about what is the default here.

Collapse
 
jsjoeio profile image
Joe Previte (he/him)

Hi Ahmad! Sorry to hear about the trouble you had 😢

But it sounds like you were able to figure it out? Is there anything you'd like me to add to the post to better clarify using this method as an alias vs using the regular code command?

Collapse
 
ryansmith profile image
Ryan Smith

What is the benefit of this approach over workspaces? This seems like manual work when a VSCode workspace can be saved with per-workspace settings, extensions, etc. You simply re-open the workspace and pick up where you left off.

Collapse
 
jsjoeio profile image
Joe Previte (he/him)

Yes, that's true. But based on my understanding, aren't workspaces tied to your repository in the .vscode/ directory?

So the advantage to this approach is you can launch any project by using this command, without having to manually change the workspace settings.

Collapse
 
ryansmith profile image
Ryan Smith

You can use "Save Workspace As" and save it anywhere you would like. Then open the .code-workspace file to open it from anywhere.

Thread Thread
 
jsjoeio profile image
Joe Previte (he/him)

Oh, now I see what you're saying. Save it somewhere and then with each project, you load the workspace. So it's never tied to a repository. Smart!

Collapse
 
quinncuatro profile image
Henry Quinn

Never really explained what a Code Profile is.

Just different versions of applied settings?

Collapse
 
jsjoeio profile image
Joe Previte (he/him)

Sorry, Henry. I will add a definition at the top! But yes, it's just a different settings configuration.

Collapse
 
quinncuatro profile image
Henry Quinn

Word, thanks! :)

Thread Thread
 
jsjoeio profile image
Joe Previte (he/him)

Thanks for helping me improve the post! 🙏🏼

Collapse
 
ssmusoke profile image
Stephen Senkomago Musoke

Do the profiles allow for enabling different language extensions such that one can have a Python or PHP or Document Editing profile?

Collapse
 
jsjoeio profile image
Joe Previte (he/him)

Yes! I didn't cover that in this article but if you take a look at Andy's repo, you can see how he does it:

github.com/avanslaars/code-profiles

Collapse
 
thebenforce profile image
Ben Force

I'm starting to record screencasts and this is going to make it 10x easier, thank you!!

Collapse
 
alejandronanez profile image
Alejandro Ñáñez Ortiz

Just what I looking for @jsjoeio , thanks!!!