I want to know if it is possible to create different instances of programming in VSCode?
( — In case it wasn’t clear — )
Idea: I want to program in a certain language and I want my extensions active only for that language.
I read a little about VSCode Workspaces, but I didn’t understand.
3
Answers
VS Code extension enablement has two "layers": The "global layer", and the "workspace layer". You can control enablement globally, and then override the global value on a per-workspace basis. As far as I know at the time of this writing, there is no way to enable/disable an extension only for a particular file, or for files of a particular language, or for a particular root in a multi-root workspace.
What I’d suggest is to only leave globally enabled the extensions that you’re pretty sure you’ll want enabled for all workspaces, and then enable the rest on a per-workspace-basis.
You could/should also check if the extension of interest contributes a setting to allow you to filter / exclude certain files by language association / mode, or by path glob patterns.
Yes, it is possible to organize your extensions in VSCode. VSCode gets a bit clunky after installation of many extensions (made even worse in a corporate laptop that has many security scanning tools enabled in the background).
I used to use workspaces to configure my extensions but I find it troublesome having to reinstall extensions for every new project.
Since 2023 July’s release of VSCode, there is a new feature called VSCode Profiles.
In each "Profile", you can configure language/framework specific settings.
Profiles can be accessed from the "File" Menu.
For example, I have these profiles:
Profiles are specific to the opened VSCode instance. So it is possible to open 2 VSCode instances (Ctrl+shift+n) each with a specific profile. E.g. python backend in VSCode window 1, React frontend profile in VSCode window 2.
I first set up Default profile to contain the extensions I want for all my other profiles. When installing an extension you want to apply for all other profiles, ensure you select "Apply extension to all profiles" by right-clicking the extension.
Then, to create a language/framework-specific VSCode profile, I create it like this.