astral-sh / ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.
Other
1.08k stars 53 forks source link

Ruff breaks file saving #549

Closed rschuetzler closed 2 months ago

rschuetzler commented 2 months ago

Disabling other extensions did not help, but disabling Ruff did.

System info:

charliermarsh commented 2 months ago

Do you have Python installed? Do you see a Python interpreter in the bottom right of your extension?

Screenshot 2024-07-22 at 10 56 03 PM

rschuetzler commented 2 months ago

Yes, I've got Python installed and the interpreter select. I actually go the "Discovering Python interpreters" issue fixed after removing the Python extension and reinstalling. But I still have issues when Ruff is installed. Saving files results in "Saving example.py: Getting code actions from Ruff, Jupyter, GitHub Copilot Chat".

Disabling the Ruff extension fixes the problem

charliermarsh commented 2 months ago

What happens if you uninstall Ruff and install an extension like Black or isort? Do you see the same behavior?

rschuetzler commented 2 months ago

Nope, it's just Ruff that causes the issue.

dhruvmanila commented 2 months ago

Can you share the following information?

rschuetzler commented 2 months ago

Sorry for the delay - went on vacation.

Python extensions:

Ruff settings are all default from a fresh install.

2024-08-06 16:23:24.980 [info] Name: Ruff
2024-08-06 16:23:24.980 [info] Module: ruff
2024-08-06 16:23:24.980 [info] Python extension loading
2024-08-06 16:23:24.980 [info] Waiting for interpreter from python extension.
2024-08-06 16:23:24.980 [info] Python extension loaded
2024-08-06 16:23:24.980 [info] Using interpreter: /Users/ryan/.pyenv/versions/3.12.4/bin/python
2024-08-06 16:23:25.051 [info] Using the Ruff binary: /Users/ryan/.pyenv/versions/3.12.4/bin/ruff
2024-08-06 16:23:25.290 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-08-06 16:23:25.292 [info] Found Ruff 0.5.4 at /Users/ryan/.pyenv/versions/3.12.4/bin/ruff
2024-08-06 16:23:25.292 [info] Server run command: /Users/ryan/.pyenv/versions/3.12.4/bin/ruff server
2024-08-06 16:23:25.293 [info] Server: Start requested.
2024-08-06 16:23:30.150 [info] warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `System/Volumes/Data/Users/ryan/.vscode-insiders/extensions/ms-python.python-2023.20.0/pythonFiles/pyproject.toml`:
  - 'ignore' -> 'lint.ignore'

2024-08-06 16:23:30.286 [info] warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `System/Volumes/Data/Users/ryan/.vscode-insiders/extensions/charliermarsh.ruff-2023.44.0-darwin-arm64/pyproject.toml`:
  - 'select' -> 'lint.select'

2024-08-06 16:23:41.113 [info] warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `Users/ryan/.vscode-insiders/extensions/ms-python.python-2023.20.0/pythonFiles/pyproject.toml`:
  - 'ignore' -> 'lint.ignore'

2024-08-06 16:23:41.216 [info] warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `Users/ryan/.vscode-insiders/extensions/charliermarsh.ruff-2023.44.0-darwin-arm64/pyproject.toml`:
  - 'select' -> 'lint.select'
rschuetzler commented 2 months ago

I'm also getting the following message repeatedly from VS code, but only when Ruff is installed.

Screenshot 2024-08-06 at 4 43 40 PM

dhruvmanila commented 2 months ago

Can you specify the path to the file you're opening in VS Code? I'm wondering if it's in the home directory. If it is, it could be related to https://github.com/astral-sh/ruff/issues/11366 as it's trying to walk through your entire home directory. This would also be the reason that you're seeing a popup from VS Code about allowing access.

Can you also try upgrading the extension and Ruff to the latest version (if not already)?

rschuetzler commented 2 months ago

Ah, that does seem to fix it. The file was in ~/code, which is a directory that stores many different projects. When I moved it to ~/code/temp the issue seems to be resolved.

Duplicate of #11366