Skip to content

Can't exclude specified file from auto formatting when using autopep8 #17188

Description

Discussed in #17148

Originally posted by Iftakharpy August 28, 2021
Can anyone help me to ignore the "settings.py" file in a Django project to be formatted on save? I have tried for 2 hours but couldn't get it to work. I am using Windows 10.

My vscode configurations:

{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[python]": {
    "editor.defaultFormatter": "ms-python.python",
    "editor.tabSize": 4,
    "editor.insertSpaces": true,
    "editor.formatOnSave": true
  },
  "python.formatting.autopep8Args": ["--exclude=settings.py"]
}

I also tried:
- "python.formatting.autopep8Args": ["--exclude settings.py"]
- "python.formatting.autopep8Args": ["--exclude */settings.py"]
- "python.formatting.autopep8Args": ["--exclude", "settings.py"]
- "python.formatting.autopep8Args": ["--exclude", "*/settings.py"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-formattingbugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions