Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"ms-vscode.cpptools",
"ms-python.python",
"ms-python.vscode-pylance",
"ban.spellright",
"ms-iot.vscode-ros",
"ExecutableBookProject.myst-highlight",
"ms-python.vscode-pylance",
"charliermarsh.ruff",
]
}
7 changes: 1 addition & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
// run formatter
"label": "run_formatter",
"type": "shell",
"linux": {
"command": "${workspaceFolder}/isaaclab.sh --format"
},
"windows": {
"command": "${workspaceFolder}/isaaclab.bat --format"
}
"command": "uv run isaaclab --format"
}
]
}
34 changes: 21 additions & 13 deletions .vscode/tools/launch.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,51 @@
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"type": "debugpy",
"request": "launch",
// Use the interpreter recorded by `isaaclab --editor`; VS Code skips wrapper scripts such as python.sh
"python": "${config:python.defaultInterpreterPath}",
"program": "${file}",
"console": "integratedTerminal"
},
// Attach to listening debugpy
// Usage (VSCode but should be similar for other IDEs):
// 1. Set your breakpoints
// 2. Run your code under debugpy like so:
// ./isaaclab.sh -p -m debugpy --listen 3000 --wait-for-client -c "from isaaclab.cli import cli; cli()" [cli_args]
// uv run python -m debugpy --listen 3000 --wait-for-client -c "from isaaclab.cli import cli; cli()" [cli_args]
// 3. Select this "Python: Debugger Attach" configuration and press green play button or F5
{
"name": "Python: Debugger Attach",
"type": "python",
"type": "debugpy",
"request": "attach",
"port": 3000,
"host": "localhost"
"connect": {
"host": "localhost",
"port": 3000
}
},
{
"name": "Python: Train Environment",
"type": "python",
"type": "debugpy",
"request": "launch",
"args" : ["--task", "Isaac-Reach-Franka-v0"],
"program": "${workspaceFolder}/scripts/reinforcement_learning/rsl_rl/train.py",
"python": "${config:python.defaultInterpreterPath}",
"module": "isaaclab",
"args": ["train", "--rl_library", "rsl_rl", "--task", "Isaac-Reach-Franka"],
"console": "integratedTerminal"
},
{
"name": "Python: Play Environment",
"type": "python",
"type": "debugpy",
"request": "launch",
"args" : ["--task", "Isaac-Reach-Franka-v0", "--num_envs", "32"],
"program": "${workspaceFolder}/scripts/reinforcement_learning/rsl_rl/play.py",
"python": "${config:python.defaultInterpreterPath}",
"module": "isaaclab",
"args": ["play", "--rl_library", "rsl_rl", "--task", "Isaac-Reach-Franka", "--num_envs", "32"],
"console": "integratedTerminal"
},
{
"name": "Python: SinglePytest",
"type": "python",
"type": "debugpy",
"request": "launch",
"python": "${config:python.defaultInterpreterPath}",
"module": "pytest",
"args": [
"${file}"
Expand All @@ -52,8 +59,9 @@
},
{
"name": "Python: ALL Pytest",
"type": "python",
"type": "debugpy",
"request": "launch",
"python": "${config:python.defaultInterpreterPath}",
"module": "pytest",
"args": ["source/isaaclab/test"],
"console": "integratedTerminal",
Expand Down
46 changes: 0 additions & 46 deletions .vscode/tools/settings.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"**/*.egg-info": true
},
"files.associations": {
"*.tpp": "cpp",
"*.kit": "toml",
"*.rst": "restructuredtext"
},
Expand All @@ -19,59 +18,14 @@
"**/_isaac_sim/**": true,
"**/_compiler/**": true
},
// Configuration for spelling checker
"spellright.language": [
"en-US-10-1."
],
"spellright.documentTypes": [
"markdown",
"latex",
"plaintext",
"cpp",
"asciidoc",
"python",
"restructuredtext"
],
"cSpell.words": [
"literalinclude",
"linenos",
"instanceable",
"isaacSim",
"jacobians",
"pointcloud",
"ridgeback",
"rllib",
"robomimic",
"teleoperation",
"xform",
"numpy",
"flatcache",
"physx",
"dpad",
"gamepad",
"linspace",
"upsampled",
"downsampled",
"arange",
"discretization",
"trimesh",
"uninstanceable",
"coeff",
"prestartup"
],
// This enables python language server. Seems to work slightly better than jedi:
"python.languageServer": "Pylance",
// Use ruff as a formatter and linter
"ruff.configuration": "${workspaceFolder}/pyproject.toml",
// Use docstring generator
"autoDocstring.docstringFormat": "google",
"autoDocstring.guessTypes": true,
// Python environment path
// note: the default interpreter is overridden when user selects a workspace interpreter
// in the status bar. For example, the virtual environment python interpreter
"python.defaultInterpreterPath": "${workspaceFolder}/_isaac_sim/python.sh",
// ROS distribution
"ros.distro": "noetic",
// Language specific settings
"[python]": {
"editor.tabSize": 4
Expand Down
7 changes: 7 additions & 0 deletions docs/source/developer-tools/editor_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ The editor selection takes precedence over this default. If you change
environments, rerun setup and select the new interpreter from the status bar or
with **Python: Select Interpreter** in the command palette.

The generated launch configurations always run this recorded interpreter. VS Code
resolves wrapper scripts such as ``_isaac_sim/python.sh`` to the underlying Python
executable, which skips the environment setup that Isaac Sim requires. If
``.vscode/launch.json`` already exists, setup preserves it; add
``"python": "${config:python.defaultInterpreterPath}"`` to each configuration, or
delete the file and rerun setup to regenerate it.

For more information about selecting a Python interpreter, see the
`VS Code documentation <https://code.visualstudio.com/docs/python/environments#_working-with-python-interpreters>`_.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Fixed
^^^^^

* Fixed ``isaaclab --editor`` failing or writing invalid JSON when the interpreter path contained
backslashes. The interpreter path in ``.vscode/settings.json`` was JSON-encoded.
* Removed the deprecated Black, Flake8, and Jedi settings from the fallback VS Code settings
generated by ``isaaclab --editor`` in favor of Ruff.
11 changes: 3 additions & 8 deletions source/isaaclab/isaaclab/utils/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,8 @@
"editor.rulers": [120],

"python.languageServer": "Pylance",
"python.jediEnabled": false,
"python.defaultInterpreterPath": "",

"python.formatting.provider": "black",
"python.formatting.blackArgs": ["--line-length", "120"],

"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,

"[python]": {
"editor.tabSize": 4
}
Expand Down Expand Up @@ -227,9 +220,11 @@ def _overwrite_default_python_interpreter(settings: str, isaacsim_dir: pathlib.P
wrapper = isaacsim_dir / "python.sh"
if wrapper.is_file():
python_exe = wrapper
# JSON-encode the path and bypass re.sub escape handling so backslashes stay valid
interpreter_setting = f'"python.defaultInterpreterPath": {json.dumps(python_exe.as_posix())}'
return re.sub(
r'"python\.defaultInterpreterPath": ".*?"',
f'"python.defaultInterpreterPath": "{python_exe.as_posix()}"',
lambda _: interpreter_setting,
settings,
flags=re.DOTALL,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Extended editor setup test coverage to interpreter paths containing backslashes. No user-visible behavior changed.
9 changes: 6 additions & 3 deletions source/isaaclab_rl/test/test_template_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,10 @@ def test_editor_setup_combines_simulator_local_and_installed_paths(tmp_path, mon
]


def test_editor_setup_uses_workspace_templates(tmp_path, monkeypatch):
"""Editor setup must generate workspace files without a project-local Python wrapper."""
@pytest.mark.parametrize("interpreter", [sys.executable, r"C:\Users\me\.venv\Scripts\python.exe"])
def test_editor_setup_uses_workspace_templates(tmp_path, monkeypatch, interpreter):
"""Editor setup must generate valid workspace files without a project-local Python wrapper."""
monkeypatch.setattr(sys, "executable", interpreter)
project_dir = tmp_path / "project"
tools_dir = project_dir / ".vscode" / "tools"
tools_dir.mkdir(parents=True)
Expand All @@ -499,7 +501,8 @@ def test_editor_setup_uses_workspace_templates(tmp_path, monkeypatch):

settings = (project_dir / ".vscode" / "settings.json").read_text()
assert "automatically generated by `isaaclab --editor`" in settings
assert Path(sys.executable).as_posix() in settings
settings_json = json.loads("".join(line for line in settings.splitlines() if not line.startswith("//")))
assert settings_json["python.defaultInterpreterPath"] == Path(interpreter).as_posix()
assert (project_dir / ".vscode" / "launch.json").is_file()
assert not (tools_dir / "setup_vscode.py").exists()
assert json.loads((project_dir / "pyrightconfig.json").read_text()) == {"extraPaths": []}
Expand Down
5 changes: 1 addition & 4 deletions tools/template/templates/external/.vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"recommendations": [
"ms-python.python",
"ms-python.vscode-pylance",
"ban.spellright",
"ms-iot.vscode-ros",
"ms-python.black-formatter",
"ms-python.flake8",
"charliermarsh.ruff",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"name": "Python: Current File",
"type": "debugpy",
"request": "launch",
// Use the interpreter recorded by `isaaclab --editor`; VS Code skips wrapper scripts such as python.sh
"python": "${config:python.defaultInterpreterPath}",
"program": "${file}",
"console": "integratedTerminal"
},
Expand All @@ -15,6 +17,7 @@
"name": "Train {{ specification.task.id }} with {{ rl_library.name }} ({{ rl_algorithm|upper }})",
"type": "debugpy",
"request": "launch",
"python": "${config:python.defaultInterpreterPath}",
"module": "isaaclab",
"args": [
"train",
Expand All @@ -29,6 +32,7 @@
"name": "Play {{ specification.task.id }} with {{ rl_library.name }} ({{ rl_algorithm|upper }})",
"type": "debugpy",
"request": "launch",
"python": "${config:python.defaultInterpreterPath}",
"module": "isaaclab",
"args": [
"play",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"files.associations": {
"*.tpp": "cpp",
"*.kit": "toml",
"*.rst": "restructuredtext"
},
Expand All @@ -14,58 +13,14 @@
"**/_isaac_sim/**": true,
"**/_compiler/**": true
},
// Configuration for spelling checker
"spellright.language": [
"en-US-10-1."
],
"spellright.documentTypes": [
"markdown",
"latex",
"plaintext",
"cpp",
"asciidoc",
"python",
"restructuredtext"
],
"cSpell.words": [
"literalinclude",
"linenos",
"instanceable",
"isaacSim",
"jacobians",
"pointcloud",
"ridgeback",
"rllib",
"robomimic",
"teleoperation",
"xform",
"numpy",
"tensordict",
"flatcache",
"physx",
"dpad",
"gamepad",
"linspace",
"upsampled",
"downsampled",
"arange",
"discretization",
"trimesh",
"uninstanceable"
],
// This enables python language server. Seems to work slightly better than jedi:
"python.languageServer": "Pylance",
// Use ruff as a formatter and linter
"ruff.configuration": "${workspaceFolder}/pyproject.toml",
// Use docstring generator
"autoDocstring.docstringFormat": "google",
"autoDocstring.guessTypes": true,
// Python environment path
// note: the default interpreter is overridden when user selects a workspace interpreter
// in the status bar. For example, the virtual environment python interpreter
"python.defaultInterpreterPath": "",
// ROS distribution
"ros.distro": "noetic",
// Language specific settings
"[python]": {
"editor.tabSize": 4
Expand Down
Loading