1

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?

Achim
  • 15,415
  • 15
  • 80
  • 144

1 Answers1

1

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.

fannheyward
  • 18,599
  • 12
  • 71
  • 109