最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin5浏览0评论

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.

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.

Share Improve this question edited Jul 5, 2022 at 20:41 Mark 184k30 gold badges539 silver badges549 bronze badges asked Feb 19, 2022 at 14:44 AmirrezaAmirreza 4734 silver badges13 bronze badges 1
  • create workspaces, you can enable/disable extension per workspace – rioV8 Commented Feb 19, 2022 at 14:52
Add a ment  | 

3 Answers 3

Reset to default 7

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

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

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

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./docs/getstarted/settings

my .vscode/setting.json

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

enter image description here

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论