NwMan
NwMan

Reputation: 317

Set environment variables when using Visual Studio Code with remote-ssh extension

I am trying to use Visual Studio Code with Remote-SSH extention (so I am working on a Windows machine while project files are on remote Linux server).

In order to build the project (C++ & CMake) I need to execute a script which sets up some environment variables.

Is there a way to execute such script automatically when vscode starts up its server?

It seems to be useless for me to call this script using vscode's terminal because then these variables are availiable only in this terminal session and not for the tools & extensions which vscode uses.

Upvotes: 9

Views: 4884

Answers (1)

Gianluca P.
Gianluca P.

Reputation: 1551

I've put something like this in my ~/.bashrc, I guess other login scripts may be used instead based on you shell, hope it helps:

if [[ $TERM_PROGRAM = 'vscode' ]]; then
    export DISPLAY=:100
fi

Upvotes: 4

Related Questions