Set workspace-specific environment variables
This small tutorial will help you to create a workspace-specific environment, allowing you to set and/or modify environment variables for your project (e.g: put the needed toolchain in front of your PATH).
This is particularly useful when working on remote machines in order
to avoid modifying the environment globally just to work on a given project.
Prerequisites
To successfully complete this tutorial, you must do the following:
-
Install Visual Studio Code.
-
Install the
Ada extension for VS Code.
You can install the Ada extension by searching for 'adacore' in the
Extensions view (Ctrl+Shift+X).
-
Have a an installed GNAT toolchain for your platform (see here for more information on how to install it).
How to set environment variables
Basically you just need to specify your environment variables and their associated values via the terminal.integrated.env.* VS Code settings in your workspace file (or your settings.json file), like in the following example:
Example
You can check the Custom Env code sample in this repository to have an example of workspace that sets a custom environment.