Visual Studio Code - Custom Profiles

Faster loading / Windows 10

When you are working on big projects like eg. Nexss Programmer which has many of the programming languages implemented, you want to switch between environments very fast and easy, otherwise it's very possible that you would lose your will. One of the reasons where VSCode is loading slowly are the extensions. If you have many addons enabled loading of the vscode can increasy drastically. Here is the solution by creating custom profiles.

Here is the most convinient one: (Windows 10). Easy to setup and use.. It will create vscode_profiles folder inside your 'home path' eg. 'c:\Users\<YourUsername>'.

Batch Script

%userprofile% - your home path
%~n0 - script name without the extension. For example if your filename for executing Rust environment is code_rs.cmd then it will be code_rs for the folder. So if you want create another profile, just create file code_YourProfileName which includes below code and you are good to go. Visual Studio Code will create folders automatically.

code --extensions-dir %userprofile%/vscode_profiles/%~n0/exts --user-data-dir %userprofile%/vscode_profiles/%~n0/data %*

Create those files somewere where you have PATH added. For example you can add it to your D:\Programs\bin\

Then add this folder to your system path.

# For the whole machine(all users):
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";D:\Programs\bin", [EnvironmentVariableTarget]::Machine)
or simpler with strings:
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";D:\Programs\bin", "Machine")

# For the current user:
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";D:\Programs\bin", [EnvironmentVariableTarget]::User)
or with strings:
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";D:\Programs\bin", "User")

Powershell

Here is the implementation in the Powershell. You can add it to your profile script by code $PROFILE. It will open your powershell profile and you can paste it there.. Then from now you can run code_rs . code_node somefolder etc. etc.

function code_rs { code --extensions-dir $HOME/vscode_profiles/code-rust/exts --user-data-dir $HOME/vscode_profiles/code-rust/data $args }
function code_node { code --extensions-dir $HOME/vscode_profiles/code-node/exts --user-data-dir $HOME/vscode_profiles/code-node/data $args }
function code_v { code --extensions-dir $HOME/vscode_profiles/code-v/exts --user-data-dir $HOME/vscode_profiles/code-v/data $args }
function code_php { code --extensions-dir $HOME/vscode_profiles/code-php/exts --user-data-dir $HOME/vscode_profiles/code-php/data $args }
function code_html { code --extensions-dir $HOME/vscode_profiles/code-html/exts --user-data-dir $HOME/vscode_profiles/code-html/data $args }

This can be done in many ways, but it's quite satisfying, helps during development and saves a lot of time during development.

If you found it valuable, please join to the nexss.com supporters at: Support Nexss.com