Skip to content

Commit 6262592

Browse files
docs(tooling): add troubleshooting entry for vs code autoformatting (#2214)
Co-authored-by: danceratopz <[email protected]>
1 parent 3d5326d commit 6262592

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/getting_started/installation_troubleshooting.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,25 @@ This page provides guidance on how to troubleshoot common issues that may arise
117117

118118
This will enable the legacy cryptographic algorithms, including RIPEMD160. See [ethereum/execution-specs#506](https://github.com/ethereum/execution-specs/issues/506) for more information.
119119

120+
## Problem: VS Code "Autoformat on Save" with Ruff Not Working
121+
122+
!!! danger "Problem: 'Autoformat on Save' with Ruff not working as expected in VS Code"
123+
If you are using VS Code and "autoformat on save" is not working as expected, or if it produces different formatting than the official `tox -e lint` command, you may have a version mismatch with the `ruff` formatter. This problem can be confirmed if `git diff` shows changes to an otherwise unmodified file after you have saved it.
124+
125+
This issue often occurs when VS Code is not configured to use the project's virtual environment (`.venv`) or if the linting dependencies have not been installed. In this case, VS Code's Ruff extension falls back to a bundled version of `ruff`, which may not match the version pinned in the project's `pyproject.toml` file.
126+
127+
!!! success "Solution: Install all required dependencies and select the correct interpreter"
128+
129+
1. Ensure all dependencies are installed, including the `lint` extras.
130+
131+
```bash
132+
uv sync --all-extras
133+
```
134+
135+
2. In VS Code, open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) and select `Python: Select Interpreter`.
136+
137+
3. Choose the interpreter located in the project's `.venv` directory. This ensures VS Code uses the correct `ruff` version from your project's environment.
138+
120139
## Other Issues Not Listed?
121140

122141
If you're facing an issue that's not listed here, you can easily report it on GitHub for resolution.

0 commit comments

Comments
 (0)