astral-sh / ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.
Other
945 stars 45 forks source link

Ruff format/fix on save not working in devcontainer until after window reload #501

Open eschnitzler opened 1 week ago

eschnitzler commented 1 week ago

I am encountering an issue with the Ruff VSCode extension where the autofix on save feature does not work initially when using a devcontainer. The feature only starts working after I reload the VSCode window.

Steps to Reproduce:

  1. Open a project in a VSCode devcontainer.
  2. Ensure that the recommended settings are configured in devcontainer.json:
    "[python]": {
                    "editor.formatOnSave": true,
                    "editor.codeActionsOnSave": {
                        "source.fixAll": "explicit",
                        "source.organizeImports": "explicit"
                    },
                    "editor.defaultFormatter": "charliermarsh.ruff"
                }
  3. Make an auto-fixable linting error in a python file and try to save it.

Expected Behavior: The Ruff extension should automatically format and fix issues on save without needing to reload the VSCode window first.

Additional Information:

VSCode Version: 1.90.2 Ruff Extension Version: v2024.28.0 Operating System: Pop_Os 22.04