You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configure/command-line.md
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,7 @@ There are several CLI options that help with reproducing errors and advanced set
124
124
Argument|Description
125
125
------------------|-----------
126
126
`--extensions-dir <dir>` | Set the root path for extensions.<br>Overridden in [Portable Mode](/docs/editor/portable.md) by the `data` folder.
127
-
`--user-data-dir <dir>` | Specifies the directory that user data is kept in, useful when running as root.<br>Overridden in [Portable Mode](/docs/editor/portable.md) by the `data` folder.
127
+
`--user-data-dir <dir>` | Specifies the directory that user data is kept in. Can be used to run multiple isolated instances of VS Code with separate environments, settings, and extensions. Also useful when running as root.<br>Overridden in [Portable Mode](/docs/editor/portable.md) by the `data` folder.
128
128
`-s, --status` | Print process usage and diagnostics information.
129
129
`-p, --performance` | Start with the **Developer: Startup Performance** command enabled.
`--add <dir>` | Add folder(s) to the last active window for a multi-root workspace.
136
136
`--remove <dir>` | Remove folder(s) from the last active window for a multi-root workspace.
137
137
138
+
## Isolating VS Code instances
139
+
140
+
By default, VS Code instances share environment variables in the following way:
141
+
142
+
* If this is the first VS Code instance, environment variables are inherited from the parent process.
143
+
* If this is not the first VS Code instance, environment variables are inherited from the already running VS Code instance.
144
+
145
+
This behavior can cause issues when you need different environment variables for different projects or build configurations. For example, if you're working on two projects that require different versions of Node.js or different `PATH` settings.
146
+
147
+
To run VS Code instances with separate environment variables, use the `--user-data-dir` option to specify a unique user data directory for each instance:
Each instance with a different `--user-data-dir` will maintain its own:
158
+
159
+
* Environment variables
160
+
* Settings and preferences
161
+
* Installed extensions
162
+
* UI state and layout
163
+
164
+
> [!NOTE]
165
+
> When using `--user-data-dir`, you'll need to reinstall extensions for each user data directory, as extensions are stored separately.
166
+
138
167
### Create remote tunnel
139
168
140
169
VS Code integrates with other [remote environments](/docs/remote/remote-overview.md) to become even more powerful and flexible. Our goal is to provide a cohesive experience that allows you to manage both local and remote machines from one, unified CLI.
Copy file name to clipboardExpand all lines: docs/terminal/advanced.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,6 +176,15 @@ When VS Code is opened, it launches a login shell environment in order to source
176
176
177
177
This environment inheritance can be disabled on macOS and Linux via the `setting(terminal.integrated.inheritEnv)` setting.
178
178
179
+
### Environment variables between VS Code instances
180
+
181
+
When launching multiple VS Code instances, environment variables are shared between them:
182
+
183
+
* The first VS Code instance inherits environment variables from the parent process (for example, the shell or application that launched VS Code).
184
+
* Subsequent VS Code instances inherit environment variables from the first running VS Code instance, not from the parent process.
185
+
186
+
To isolate environment variables between VS Code instances, use the [`--user-data-dir` command-line option](/docs/configure/command-line.md#isolating-vs-code-instances) to run each instance with a separate user data directory. This ensures that each instance maintains its own environment, settings, and extensions.
187
+
179
188
### Interaction with `$LANG`
180
189
181
190
There is some special interaction with the `$LANG` environment variable, which determines how characters are presented in the terminal. This feature is configured with the `setting(terminal.integrated.detectLocale)` setting:
0 commit comments