DVT IDE for VS Code VHDL User Guide
Rev. 24.1.12, 12 June 2024

31.2 Environment Variables

The preference DVT.environment.variables allows you to create or overwrite environment variables. The resulting environment variables are computed according to DVT.environment.precedence preference and will be used during the extension's runtime, for running Language Servers and tasks or as environment for terminals.

Define Variables

To define a new environment variable, simply add a new entry in the DVT.environment.variables preference.

How is the Environment Computed

The environment is computed based on the value of DVT.environment.precedence preference:

  • Settings environment variables: the variables defined in DVT.environment.variables will overwrite any variables found in the native environment.

  • Native environment variables: new variables will be added only if they are not found in the native environment.

For tasks and terminals, the VS Code's native environment is defined by: terminal.integrated.env.{linux,windows,osx} preference applied over VS Code process environment, while for the rest is defined by only the process environment.


 DVT.environment.precedence = "Native environment variables"

 Native Environment:
   MY_VARIABLE = /home/dvt/projects

   MY_VARIABLE = /home/dvt/other_projects

The value of MY_VARIABLE will be "/home/dvt/projects".

For a fine-grained control over how variables are composed, you can reference already existing ones using the following syntax: ${env:VARIABLE_NAME}


DVT.environment.precedence = "Settings environment variables"

 Native Environment:
   PATH = /bin

   PATH = /opt/tools:${env:PATH}

The value of PATH will be "/opt/tools:/bin".

Note: The DVT.license.source preference always has precedence over the value of DVT_LICENSE_FILE set in DVT.environment.variables.

Use Case

The VS Code Remote - SSH extension allows you to open a folder located on any machine that has a running SSH server. The typical use case is running the VSCode UI on a Windows machine and connecting to a Linux server machine. The environment variables on the remote machine are not inherited from the machine where you started VS Code. To maintain the consistency of the environment, you can use the DVT.environment.variables preference to predefine variables of interest.