neoclide / coc-python

Python extension for coc.nvim, fork of vscode-python
573 stars 51 forks source link

coc formatter deleting lines when formatting sometimes #313

Open himat opened 3 years ago

himat commented 3 years ago

For some reason, sometimes, the auto formatter is deleting entire functions in my python files!

I save inside vim with :w, and then it auto formats with black, but then sometime a function or class might just be deleted.

It doesn't happen all the time though, just randomly, and I'm unable to reproduce this. But this is making it very dangerous for me to even use the auto formatter even though it's very helpful.

Here is my .vim/coc-settings.json file

{
    eslint.filetypes: [javascript, javascriptreact, typescript, typescriptreact],
    coc.preferences.formatOnSaveFiletypes: [python],
    python.jediEnabled: false,
    python.formatting.provider: black,
    python.linting.pylintEnabled: false,
    python.linting.mypyEnabled: true,
    python.linting.enabled: true
}

Any suggestions on what to do here?

himat commented 3 years ago

It seems this person had the same issue but with coc java: https://github.com/neoclide/coc-java/issues/62

Is there a way to do what they did to fix it but for python?