Skip to content

Enabling FormatOnSave with Black makes saving files impossible #19

@tomkcook

Description

@tomkcook

Type: Bug

Open workspace settings and enable "FormatOnSave".

Open a Python file and configure Black as the default formatter.

Make a change and attempt to save the file.

Every time I try to save a file, VScode pops up a note that the file has changed on disk and do I really want to overwrite the change?

This only affects Python files formatted with Black. I assume the Black formatter is being run on the file in the background before saving the file and this results in the file being changed on disk, which VScode then fails to reload correctly.

Extension version: 1.0.3
VS Code version: Code 1.86.1 (31c37ee8f63491495ac49e43b8544550fbae4533, 2024-02-07T09:07:19.849Z)
OS version: Linux x64 6.6.10-060610-generic
Modes:

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i9-13900HX (32 x 3205)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 1, 1, 1
Memory (System) 31.15GB (11.25GB free)
Process Argv . --crash-reporter-id b8a9e683-f4ee-415b-9c94-a32686cb170e
Screen Reader no
VM 0%
DESKTOP_SESSION gnome
XDG_CURRENT_DESKTOP GNOME
XDG_SESSION_DESKTOP gnome
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
vscaac:30438847
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
pydisww2:30959801
7j2b6412:30962116
bg6jg535:30958357

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions