Skip to content

Fixes invalid JSON in generated VS Code settings on Windows - #6757

Closed
mgwedd wants to merge 1 commit into
isaac-sim:developfrom
mgwedd:fix/vscode-settings-json-escaping
Closed

mgwedd wants to merge 1 commit into
isaac-sim:developfrom
mgwedd:fix/vscode-settings-json-escaping

Conversation

@mgwedd

@mgwedd mgwedd commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

python -m isaaclab --generate-vscode-settings writes .vscode/settings.json by
substituting the interpreter path and every discovered extension path into a JSON
template verbatim. On Windows those paths contain backslashes, so the generated
file is full of invalid JSON escape sequences ("C:\Users\..." — \U is not a
valid escape) and VS Code rejects the settings, which is exactly what #3965 reports.

This change serializes each path with json.dumps before substitution, which
escapes backslashes (and any other JSON-special characters) correctly on every
platform. On Linux/macOS the output is byte-identical to before, since POSIX paths
contain nothing to escape.

Fixes #3965

Type of change

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

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog entry to the changelog.d directory
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Verification (no Isaac Sim needed — the substitution is pure string logic): a
standalone check renders the template both ways with a Windows-style interpreter
path and extension path. The pre-fix rendering fails json.loads (after stripping
the // comment lines VS Code allows); the fixed rendering parses and round-trips
the exact input paths. The fix can't be a no-op on POSIX either: rendered output
for POSIX paths is unchanged.

The interpreter path and extension paths were interpolated into the
settings.json template verbatim, so Windows paths produced invalid JSON
escape sequences (e.g. "C:\Users\..."). Serialize them with
json.dumps instead.

Fixes isaac-sim#3965

Signed-off-by: Michael Wedd <[email protected]>
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team infrastructure labels Jul 28, 2026
StafaH added a commit that referenced this pull request Sep 22, 2026
# Description

Clean up the VS Code configuration for the Isaac Lab checkout and
generated external projects, and fix the open VS Code debugging and
settings-generation bugs.

**Recommendations and settings**

- Keep the Python and Pylance extensions and recommend the Ruff
extension used by the current formatter and linter configuration.
- Remove the unused C/C++, ROS, MyST, spelling, Black, and Flake8
recommendations. This also retires the archived `ms-iot.vscode-ros`
recommendation that #4402 proposed to replace.
- Remove the corresponding dead `.tpp`, Spell Right/cSpell,
autoDocstring, and ROS Noetic settings from both settings templates.
- Remove the deprecated Black, Flake8, and Jedi settings from the
fallback settings written by `isaaclab --editor`.

**Debugging (#2238)**

- Since Python extension 2024.18.0, VS Code resolves
`python.defaultInterpreterPath` wrapper scripts such as
`_isaac_sim/python.sh` to the underlying executable, so launch
configurations skip Isaac Sim's environment setup. Every launch
configuration in both templates now sets `"python":
"${config:python.defaultInterpreterPath}"`, the interpreter recorded by
`isaaclab --editor`.
- Update the repository launch template: use the `debugpy` type instead
of the deprecated `python` type, use `connect` for the attach
configuration, run training and playback through `isaaclab train`/`play`
(the old `scripts/reinforcement_learning/rsl_rl/*.py` paths no longer
exist), use the current `Isaac-Reach-Franka` task ID, and document `uv
run python -m debugpy` for attach.
- Document how to update an existing preserved `launch.json`.

**Settings generation (#3965)**

- #6644 already moved import paths to `pyrightconfig.json` via
`json.dumps`. This PR also JSON-encodes the interpreter path in
`.vscode/settings.json` and passes it to `re.sub` without escape
processing. Before this change, an interpreter path containing a
backslash crashed with `re.error: bad escape \U`. #6757 targets
`tools/wheel_builder/res/__main__.py`, which no longer exists.

**Tasks**

- Replace the deprecated `isaaclab.sh --format` / `isaaclab.bat
--format` task with `uv run isaaclab --format`.

Fixes #2238
Fixes #3965

Supersedes #4402 and #6757.

## Type of change

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

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Screenshots

Not applicable.

## Validation

- `uv run python -m pytest
source/isaaclab_rl/test/test_template_generator.py` (28 passed). The
editor setup test now also runs with a backslash interpreter path and
parses the generated settings as JSON; this case fails without the fix.
- `uv run isaaclab -f` (all hooks passed, including the changelog
fragment check against upstream `develop`)

## Checklist

- [x] I have read and understood the contribution guidelines.
- [x] I have run the complete pre-commit checks.
- [x] I have updated the editor setup documentation.
- [x] My changes generate no new warnings.
- [x] I have extended the closest editor setup test.
- [x] I have added a changelog fragment for `isaaclab` and a `.skip`
fragment for the `isaaclab_rl` test change.
- [x] My name already exists in `CONTRIBUTORS.md`.
isaaclab-bot Bot pushed a commit that referenced this pull request Sep 22, 2026
# Description

Clean up the VS Code configuration for the Isaac Lab checkout and
generated external projects, and fix the open VS Code debugging and
settings-generation bugs.

**Recommendations and settings**

- Keep the Python and Pylance extensions and recommend the Ruff
extension used by the current formatter and linter configuration.
- Remove the unused C/C++, ROS, MyST, spelling, Black, and Flake8
recommendations. This also retires the archived `ms-iot.vscode-ros`
recommendation that #4402 proposed to replace.
- Remove the corresponding dead `.tpp`, Spell Right/cSpell,
autoDocstring, and ROS Noetic settings from both settings templates.
- Remove the deprecated Black, Flake8, and Jedi settings from the
fallback settings written by `isaaclab --editor`.

**Debugging (#2238)**

- Since Python extension 2024.18.0, VS Code resolves
`python.defaultInterpreterPath` wrapper scripts such as
`_isaac_sim/python.sh` to the underlying executable, so launch
configurations skip Isaac Sim's environment setup. Every launch
configuration in both templates now sets `"python":
"${config:python.defaultInterpreterPath}"`, the interpreter recorded by
`isaaclab --editor`.
- Update the repository launch template: use the `debugpy` type instead
of the deprecated `python` type, use `connect` for the attach
configuration, run training and playback through `isaaclab train`/`play`
(the old `scripts/reinforcement_learning/rsl_rl/*.py` paths no longer
exist), use the current `Isaac-Reach-Franka` task ID, and document `uv
run python -m debugpy` for attach.
- Document how to update an existing preserved `launch.json`.

**Settings generation (#3965)**

- #6644 already moved import paths to `pyrightconfig.json` via
`json.dumps`. This PR also JSON-encodes the interpreter path in
`.vscode/settings.json` and passes it to `re.sub` without escape
processing. Before this change, an interpreter path containing a
backslash crashed with `re.error: bad escape \U`. #6757 targets
`tools/wheel_builder/res/__main__.py`, which no longer exists.

**Tasks**

- Replace the deprecated `isaaclab.sh --format` / `isaaclab.bat
--format` task with `uv run isaaclab --format`.

Fixes #2238
Fixes #3965

Supersedes #4402 and #6757.

## Type of change

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

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Screenshots

Not applicable.

## Validation

- `uv run python -m pytest
source/isaaclab_rl/test/test_template_generator.py` (28 passed). The
editor setup test now also runs with a backslash interpreter path and
parses the generated settings as JSON; this case fails without the fix.
- `uv run isaaclab -f` (all hooks passed, including the changelog
fragment check against upstream `develop`)

## Checklist

- [x] I have read and understood the contribution guidelines.
- [x] I have run the complete pre-commit checks.
- [x] I have updated the editor setup documentation.
- [x] My changes generate no new warnings.
- [x] I have extended the closest editor setup test.
- [x] I have added a changelog fragment for `isaaclab` and a `.skip`
fragment for the `isaaclab_rl` test change.
- [x] My name already exists in `CONTRIBUTORS.md`.

(cherry picked from commit 00ecf5a)
@StafaH

StafaH commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Fixed in #7940

@StafaH StafaH closed this Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] Unescaped Windows path strings in settings.json generated by python -m isaaclab --generate-vscode-settings

2 participants