Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting does not occur when file autosaved #4475

Closed
bobf32 opened this issue Oct 10, 2024 · 2 comments
Closed

Formatting does not occur when file autosaved #4475

bobf32 opened this issue Oct 10, 2024 · 2 comments
Labels
T: bug Something isn't working

Comments

@bobf32
Copy link

bobf32 commented Oct 10, 2024

Describe the bug

To Reproduce

Load a python script in VSCode.
Ensure auto save is toggled on.
Make a change to the script where the formatting is such that Black would correct.
Observe file content gets autosaved but the Black formatting is not applied.
Save with Ctrl-S
Observe that the formatting is applied.

Expected behavior

I would expect that when the file gets autosaved, the Black formatting would be applied.

  • Black's version: 2024.2.0
  • OS and Python version: Win 11 Enterprise 22H2 22621.4169
@bobf32 bobf32 added the T: bug Something isn't working label Oct 10, 2024
@bobf32 bobf32 changed the title Formatting does not occur when auto save enabled Formatting does not occur when autosave enabled Oct 10, 2024
@bobf32 bobf32 changed the title Formatting does not occur when autosave enabled Formatting does not occur when file autosaved Oct 10, 2024
@asfourco
Copy link

asfourco commented Oct 18, 2024

Is editor.formatOnSave enabled in the vscode settings? see vscode settings for python docs.

TL;DR; settings.json should contain the following:

  "[python]": {
    "editor.formatOnSave": true
    "editor.defaultFormatter": "ms-python.black-formatter"
  }

@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Oct 18, 2024

asfourco is helpful

Do also note that https://github.com/psf/black does not maintain a VSCode plugin, so if there were an issue this isn't the right repository to report it in

@hauntsaninja hauntsaninja closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants