Monday, February 15, 2021

How to use VS Code with Multiple Configurations with Backup


>PROBLEM


You need to work with different environments and workspaces for different purposes when working with different programming languages or different contexts.

For each context or environment, you've installed the desired extensions.

Also, it is interesting to keep a backup of the environment to save time.


What does happen next?

If you have just one configuration setup and many needs, the VS Code configuration begins growing, eventually getting heavy, slow, and taking too much memory.

Also, the extensions' default shortcuts begin to conflict with each other.


>SOLUTION

There are at least three approaches:

1. Versioning control using branches, or

2. Separate configuration folders, or

3. Option 1 plus option 2.


Versioning control using branches

The VS Code default folder that holds its configuration setup is under

      "C:\Users\YOUR_LOGIN\.vscode" folder.

Create a git repository there.

For each kind of environment desired, create a specific branch.

The master branch would aggregate everything, but in this case, there is no use unless you do want to keep a backup of just one setup.



Separate configuration folders

It is possible to switch environments using commands.
To do this, it is necessary to create a symbolic link to the current default extensions folder used by VS Code by default.

The default folder is at:

%USERPROFILE%\.vscode\extensions

Before creating the symbolic link, move the default extension folder to the new place desired, then create it:

mklink /D %USERPROFILE%\.vscode\extensions "NEW_PATH_DESIRED\extensions"

Ex.:
mklink /D C:\Users\YOUR_USER\.vscode\extensions "D:\ide_home\vscode\Code\extensions"



Option 1 plus option 2

You may combine the two options above, but better if the branches keep a keyword to avoid losing control.

The best of all is that you never lose your env, never need to reconfigure, and may switch fast the environments preserving then VS Code app from getting messed and slow.



ATTEMPT FAILURE NOTE


The attempt using "--user-data-dir" and/or  "--extensions-folder" flags (options) was not successful by the time I've tried using VS Code  v.1.53.2.





No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...