Unverified Commit d0310cda authored by Mayank Mittal's avatar Mayank Mittal Committed by GitHub

Moves `launch.json` to template file in `.vscode/tools` (#55)

# Description

The `launch.json` file is very user-specific. Previously this was always
getting pushed along with other commits which led to merge conflicts
when merging branches from different users.

Now, the `launch.json` is generated from a template if it doesn't
already exist in the `.vscode` directory. The users can modify the
`.vscode/launch.json` as they please afterward, but their changes won't
get pushed to git itself.

Fixes #46

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
parent bd64177c
......@@ -23,9 +23,10 @@
# IDE
**/.idea/
**/.vscode/.**
# Include all but settings.json: auto-generated using the template in .vscode/tools/settings.template.json
.vscode/settings.json
**/.vscode/
# Don't ignore the top-level .vscode directory as it is
# used to configure VS Code settings
!.vscode
# Outputs
**/output/*
......
# Note: These files are kept for development purposes only.
!tools/launch.template.json
!tools/settings.template.json
!tools/setup_vscode.py
!extensions.json
!tasks.json
# Ignore all other files
.python.env
*.json
......@@ -25,11 +25,25 @@
"host": "localhost"
},
{
"name": "Python: Run Environment",
"name": "Python: Train Environment",
"type": "python",
"request": "launch",
"args" : ["--task", "Isaac-Reach-Franka-v0"],
"program": "${file}",
"args" : ["--task", "Isaac-Reach-Franka-v0", "--headless"],
"program": "${workspaceFolder}/source/standalone/workflows/rsl_rl/train.py",
"console": "integratedTerminal",
"env": {
"EXP_PATH": "${workspaceFolder}/_isaac_sim/apps",
"RESOURCE_NAME": "IsaacSim"
},
"envFile": "${workspaceFolder}/.vscode/.python.env",
"preLaunchTask": "setup_python_env"
},
{
"name": "Python: Play Environment",
"type": "python",
"request": "launch",
"args" : ["--task", "Isaac-Reach-Franka-v0", "--num_envs", "32"],
"program": "${workspaceFolder}/source/standalone/workflows/rsl_rl/play.py",
"console": "integratedTerminal",
"env": {
"EXP_PATH": "${workspaceFolder}/_isaac_sim/apps",
......
......@@ -124,6 +124,20 @@ def main():
with open(orbit_vscode_filename, "w") as f:
f.write(orbit_settings)
# copy the launch.json file if it doesn't exist
orbit_vscode_launch_filename = os.path.join(ORBIT_DIR, ".vscode", "launch.json")
orbit_vscode_template_launch_filename = os.path.join(ORBIT_DIR, ".vscode", "tools", "launch.template.json")
if not os.path.exists(orbit_vscode_launch_filename):
# read template launch settings
with open(orbit_vscode_template_launch_filename) as f:
orbit_template_launch_settings = f.read()
# add header
header_message = header_message.replace(orbit_vscode_template_filename, orbit_vscode_template_launch_filename)
orbit_launch_settings = header_message + orbit_template_launch_settings
# write the orbit launch settings file
with open(orbit_vscode_launch_filename, "w") as f:
f.write(orbit_launch_settings)
if __name__ == "__main__":
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment