You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noticed the problem when configuring Darker on VSCode. Running the formatting command explicitly works but formatting on save does not. As noted in other issues, the only difference in executed command is that formatting on save runs on a tmp file (*.hash.tmp) instead of the file directly. Support was added to check for these tmp files but the check for them happens after filtering out the file.
The root of the error I believe is in calling git_get_modified_files, which in turn calls should_reformat_file which only allows .py files. This happens before ever accounting for possible tmp files.
I will poke a bit and see if just adding the check to should_reformat_file is sufficient to get things working.
Software Versions
Darker: 1.3.2
Python: 3.9.9
Black: 21.12b0
Isort: 5.10.1
VSCode: 1.63.2
The text was updated successfully, but these errors were encountered:
I think I solved the problem with a small change to should_reformat_file: return path.exists() and get_rev1_path(path).suffix == ".py"
(plus appropriate changes to avoid circular imports). Not sure yet what other implications this might have.
Thanks @njhuffman, I'll take a look at your fix to see if it's safe to apply. I've been wondering all along why format on save wouldn't work but never got around to actually finding the root cause since I tend to reformat using a keyboard shortcut.
Noticed the problem when configuring Darker on VSCode. Running the formatting command explicitly works but formatting on save does not. As noted in other issues, the only difference in executed command is that formatting on save runs on a tmp file (*.hash.tmp) instead of the file directly. Support was added to check for these tmp files but the check for them happens after filtering out the file.
The root of the error I believe is in calling
git_get_modified_files
, which in turn callsshould_reformat_file
which only allows.py
files. This happens before ever accounting for possible tmp files.I will poke a bit and see if just adding the check to
should_reformat_file
is sufficient to get things working.Software Versions
The text was updated successfully, but these errors were encountered: