Amirreza
Amirreza

Reputation: 463

How to create different environments to code in VS Code (e.g. :by language). [Settings Profiles]

I want to have custom settings for each library in VS Code.

For example, I want to enable a plugin in all my React projects but not in Vue JS.

I don't want to do it manually, is there a thing to switch settings?

I don't want the IDE automatically detect it, I want to create customized settings and switch between them when I need to.

Upvotes: 4

Views: 7222

Answers (3)

Mark
Mark

Reputation: 181060

There is more settings profiles support in v1.71, see v1.71 Release Notes: Settings Profiles

In this milestone, we added CLI support for Settings Profiles feature. You can now pass the name of the profile using --profile arg and open a folder or a workspace using that profile. Following instruction opens the web-sample folder with the Web Development profile. If the profile does not exist, a new empty profile with the given name is created.

code ~/projects/web-sample --profile "Web Development"

We also added support for Temporary Settings Profile that can be created and associated to a folder or workspace temporarily. This profile gets auto deleted once it is not associated to any folder or workspace.


Expanded support for "profiles" will be in a preview state in vscode v1.69. From release notes: settings profiles:

A Settings Profile comprises of settings, keyboard shortcuts, extensions, state, tasks, and snippets. You can customize VS Code for different development environments like Web, Machine Learning, or for multiple programming language classrooms like Python, Java or for personal modes like Work or Demo and save them as Settings Profiles. You can open multiple workspaces (folders) with different profiles simultaneously based on the projects you are working on or the classroom you are attending to or when you are presenting.

Below demonstrates customizing VS Code for web development environment and creating a settings profile out of it.

demo of settings profiles

[more gifs from the release notes omitted here]

You can open your React project in web development profile and Python class project in Python class profile simultaneously as shown in the following picture.

different programming environments for different languages

"workbench.colorCustomizations": {
    "statusBarItem.settingsProfilesBackground": "#ce4918",
    "statusBarItem.settingsProfilesForeground": "#e0dfdb",
}

You can manage and remove settings profiles using the Remove Settings Profile... action available in the Settings Profiles sub menu in Settings gear menu.

Even though you can customize VS Code per profile, there are some which can be customized only at application level. For example, all application scoped settings like update.mode, language pack extensions, settings sync enablement and workspace trust state shall be customized across all profiles at application level.

Upvotes: 6

Amirreza
Amirreza

Reputation: 463

As the other answers mentioned, we can create different workspaces, but this is not ideal for me!

So I found these extensions that you can create profiles and switch between them quickly.

I found these useful:

1.Profile Switcher 2.Extension profiles

Upvotes: 0

Bhuva Bhavin
Bhuva Bhavin

Reputation: 1

You can create a .vscode folder in each and every project you build, and add your customized setting.json for every project

reference https://code.visualstudio.com/docs/getstarted/settings

my .vscode/setting.json

{
  "git.ignoreLimitWarning": true,
  "editor.formatOnSave": true,
  "editor.formatOnPaste": true
}

enter image description here

Upvotes: 0

Related Questions