Search code examples
visual-studio-code

Can I configure specific VSCode extensions to only be enabled based on the current language?


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.


Solution

  • 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.

    File Menu

    For example, I have these profiles:

    • Default - Intellicode, Material Icon Theme, GitLens, WSL (This profile acts as a "base" profile of what my other profiles should have).
    • Solidity - Solidity extension on top of extensions in Default profile
    • Python - Python, Pylance, Microsoft Black Formatter on top of extensions in Default profile

    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.

    Apply extension to all profiles

    Then, to create a language/framework-specific VSCode profile, I create it like this.

    1. File > Preferences > Profiles > Create Profile...
    2. Ensure "Extensions" is checked under the "Choose what to configure in your profile" (this will ensure any new extensions you install will only remain in this profile).

    enter image description here