DEV Community

Cover image for Managing VSCode Profiles for the Polyglot Developers
Gökay Okyay
Gökay Okyay

Posted on

Managing VSCode Profiles for the Polyglot Developers

Programming languages meme

Image credit: https://programmerhumour.tumblr.com/post/187131622245/javascript-mocking-joke-645342

If you use multiple programming languages in your daily life, you probably need numerous extensions which target specific programming languages.

I use Go, Node.js, Python (sometimes), Rust and since one month, Deno. I need ESLint for Node, Go Extension for Golang, RLS for Rust and so on.

My laptop is 10 years old and it's getting slower every day so as my vscode profile. It is bloated with extensions. Think of getting minimum 3 extensions for every language you write! So what's the solution? If you don't like to hack stuff like I do, search for an extension that can help with this issue (look at the irony here). But if you're like me, the solution is VSCode Profiles!

Note: Some steps are taken from https://dev.to/jsjoeio/how-to-create-code-profiles-in-vscode-3ofo - Check out this amazing post too!

First, create the root of profiles directory by pasting following line to your terminal

cd $HOME && mkdir code-profiles && cd code-profiles
Enter fullscreen mode Exit fullscreen mode

You've probably know what the above line does but here's the explanation for those who don't: It navigates to your home directory (of your current terminal user) and creates a directory then it navigates into it.

Second, prepare the profile directory for the language you'll work with

It can be anything, I can't force you to work with a specific language or a tool 😄, but as an example I'll go with Deno.

mkdir deno
cd deno
mkdir data extensions
Enter fullscreen mode Exit fullscreen mode

(Optional) Copy your settings file

If you want to keep your current settings, open settings.json in VSCode and copy your settings. Then while in the deno directory we've just created:

cd data
mkdir User
nano settings.json
Enter fullscreen mode Exit fullscreen mode

And paste the content of settings.json.

Making our lives easier, adding an alias!

Actually this step is optional too but I strongly recomment it or you'll have to write two paths and two flags each time you want to open your profile.

cd $HOME
# I'll open my bashrc file because I'm using linux with bash but other shells are similar too
nano .bashrc
Enter fullscreen mode Exit fullscreen mode

And at the end of the file add this:

alias code-deno="code --user-data-dir ~/code-profiles/deno/data/ --extensions-dir ~/code-profiles/deno/extensions/"
Enter fullscreen mode Exit fullscreen mode

Save and close it.

Then restart your terminal or source your bashrc file:

source .bashrc
Enter fullscreen mode Exit fullscreen mode

Voila!

code-deno
Enter fullscreen mode Exit fullscreen mode

You now have a vscode profile for Deno with extensions specific to it! When you want to code with another PL just repeat the same steps for that language, and you'll have a fresh VSCode without bloated with extensions!

References

How to Create Code Profiles in VSCode
Managing Extensions in Visual Studio Code

Top comments (0)