Ruff extension not working (VS Code)
SeanPedersen opened this issue · 7 comments
I am running VS Code on a Mac M1 with a Python 3.12.5 environment. The ruff server seems stuck on start, just does not work. Strangely same computer different env with Python 3.12.4 ruff auto-format on save seems to work...
I get following log:
2024-09-10 14:15:20.829 [info] Name: Ruff
2024-09-10 14:15:20.829 [info] Module: ruff
2024-09-10 14:15:20.829 [info] Python extension loading
2024-09-10 14:15:20.830 [info] Waiting for interpreter from python extension.
2024-09-10 14:15:20.830 [info] Python extension loaded
2024-09-10 14:15:20.830 [info] Using interpreter: ..../.pixi/envs/default/bin/python3
2024-09-10 14:15:20.920 [info] Falling back to bundled executable: .../.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 14:15:20.942 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-09-10 14:15:20.943 [info] Found Ruff 0.6.4 at .../.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 14:15:20.943 [info] Server run command: .../.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff server
2024-09-10 14:15:20.943 [info] Server: Start requested.
2024-09-10 15:04:32.297 [info] Server: Stop requested
2024-09-10 15:04:33.277 [info] Name: Ruff
2024-09-10 15:04:33.277 [info] Module: ruff
2024-09-10 15:04:33.277 [info] Python extension loading
2024-09-10 15:04:33.277 [info] Waiting for interpreter from python extension.
2024-09-10 15:04:33.277 [info] Python extension loaded
2024-09-10 15:04:33.277 [info] Using interpreter: ......./.pixi/envs/default/bin/python3
2024-09-10 15:04:33.406 [info] Falling back to bundled executable: .../.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 15:04:33.417 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-09-10 15:04:33.417 [info] Found Ruff 0.6.4 at .../.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 15:04:33.417 [info] Server run command: .../.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff server
2024-09-10 15:04:33.417 [info] Server: Start requested.
2024-09-10 15:08:50.288 [info] Server: Stop requested
2024-09-10 15:09:08.117 [info] Name: Ruff
2024-09-10 15:09:08.117 [info] Module: ruff
2024-09-10 15:09:08.117 [info] Python extension loading
2024-09-10 15:09:08.117 [info] Waiting for interpreter from python extension.
2024-09-10 15:09:08.117 [info] Python extension loaded
2024-09-10 15:09:08.117 [info] Using interpreter: ..../.pixi/envs/default/bin/python3
2024-09-10 15:09:08.154 [info] Falling back to bundled executable: .../.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 15:09:08.158 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-09-10 15:09:08.159 [info] Found Ruff 0.6.4 at .../.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 15:09:08.159 [info] Server run command: .../.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff server
2024-09-10 15:09:08.159 [info] Server: Start requested.
Thanks for the report and sorry that you're facing this. I see that you're using pixi to create the virtual environment, is that correct? Can you confirm if it's the same setup on the computer where the extension is working?
The ruff server seems stuck on start, just does not work.
Can you also specify how are you determining whether the server isn't working? Is it that the violations aren't being highlighted.
Yes I am using pixi for the env.
It is the same computer and same vs code install just two different projects with two different pixi envs. I even changed the python version to 3.12.4 like the one where it is working but that did not help.
Here another log from the broken project:
2024-09-10 15:24:42.209 [info] Name: Ruff
2024-09-10 15:24:42.209 [info] Module: ruff
2024-09-10 15:24:42.210 [info] Python extension loading
2024-09-10 15:24:42.210 [info] Waiting for interpreter from python extension.
2024-09-10 15:24:42.210 [info] Python extension loaded
2024-09-10 15:24:42.210 [info] Using interpreter: home/Projects/vibe-shuffle/.pixi/envs/default/bin/python
2024-09-10 15:24:42.210 [info] Falling back to bundled executable: home/.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 15:24:42.213 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-09-10 15:24:42.215 [info] Found Ruff 0.6.4 at home/.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 15:24:42.215 [info] Server run command: home/.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff server
2024-09-10 15:24:42.215 [info] Server: Start requested.
2024-09-10 15:25:56.389 [info] Server: Stop requested
2024-09-10 15:25:58.128 [info] Name: Ruff
2024-09-10 15:25:58.128 [info] Module: ruff
2024-09-10 15:25:58.128 [info] Python extension loading
2024-09-10 15:25:58.128 [info] Waiting for interpreter from python extension.
2024-09-10 15:25:58.128 [info] Python extension loaded
2024-09-10 15:25:58.128 [info] Using interpreter: home/Projects/vibe-shuffle/.pixi/envs/default/bin/python
2024-09-10 15:25:58.330 [info] Falling back to bundled executable: home/.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 15:25:58.334 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-09-10 15:25:58.335 [info] Found Ruff 0.6.4 at home/.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff
2024-09-10 15:25:58.335 [info] Server run command: home/.vscode/extensions/charliermarsh.ruff-2024.44.0-darwin-arm64/bundled/libs/bin/ruff server
2024-09-10 15:25:58.335 [info] Server: Start requested.
I am checking if ruff is working by removing a space between function arguments to see if the auto-formatter is working.
Can you provide the VS Code settings for Ruff? Also, how are you creating the virtual environment? I can try reproducing it on my end.
Ok I just checked what happens if I insert
try:
print("hi")
except:
pass
into the project where the auto-formatting is not working on save.
And VS Code displays a problem message from Ruff (!): Do not use bare except
So only the auto-formatting seems not to work...
I see, thanks. I think the extension is working then, it might be something in your VS Code settings.
"editor.formatOnSave"
was not set globally to true but only on the project where it worked... sorry my bad, but thanks for helping anyway!