skip to Main Content

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


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

    Login or Signup to reply.
    1. Go to vscode settings.
    2. Click enter image description here at the right top to enter text mode.
    3. Then you can config different settings for different languages according to this example:

    enter image description here

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search