ms-iot / vscode-ros

Visual Studio Code extension for Robot Operating System (ROS) development
https://marketplace.visualstudio.com/items?itemName=ms-iot.vscode-ros
MIT License
388 stars 93 forks source link

[feature] Support for envFile attribute in Launch.json #918

Open ruffsl opened 1 year ago

ruffsl commented 1 year ago

As documented in the VS Code's debugging docs, many debuggers support this attribute:

envFile - path to dotenv file with environment variables https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes

The use of .env files is helpful when sharing a common set, or a large number of, environment variables across developer tools.

However, from looking at the current package.json, it seems that only the env attribute is currently supported:

https://github.com/ms-iot/vscode-ros/blob/773e8a61b0bcc551217d201194be8e3406dde274/package.json#LL157-L164C31

Here are some examples of other VS Code extensions that implement support for the envFile attribute:

https://github.com/search?type=code&auto_enroll=true&q=%22envFile%22%3A+%7B+path%3Apackage.json


For my use case, the GAZEBO_MODEL_PATH variable must be set using an arbitrary number of long paths:

. /usr/share/gazebo/setup.sh
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/$ROS_DISTRO/share/turtlebot3_gazebo/models
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/$ROS_DISTRO/share/aws_robomaker_small_warehouse_world/models

Perhaps there would be an alternate workaround, other than making one long entry under the env attribute?

ooeygui commented 1 year ago

Thank you for the request and research!