Why does NeoVim, Coc, Jedi, Mypy, ... generate some_name.py.[git hash].py files?

1.1k Views Asked by At

I have a rather basic NeoVim setup with Coc for working with Python files. My Coc config looks like this:

{
  "python.setLinter": ["mypy"],
  "python.linting.enabled": false,
  "python.linting.mypyEnabled": true,
  "python.formatting.provider": "black",
  "python.analysis.openFilesOnly": false,
  "python.jediEnabled": true,
  "coc.preferences.formatOnSaveFiletypes": [
    "python",
    "json",
    "html"
  ]
}

If I edit a file called some_name.py sometimes a file called some_name.py.[some-git-hash].py appears beside the original file. The two files are identical. I have no idea why this happens, which process/plugin/... is doing that, why it happens only sometimes and - most important: How I "enabled" this.

What's the reason for this behavior and how can I disable it again?

1

There are 1 best solutions below

0
fannheyward On

You've enable coc's formatOnSave for Python, when you do saving a Python file, coc will clone a new file, then runs your formatter, here is black, parses and applies the diff to your origin file.

But I can't reproduce this, the some_name.py.[some-git-hash].py file should be deleted after formatting.