yapf formatting fails due to wrong command (--diff instead of --in-place)
See original GitHub issueBug: Notebook Editor, Interactive Window, Editor cells
Steps to cause the bug to occur
- Configure yapf as python formatter, turn on autoformat on save
- save a file (or format a document)
Actual behavior
Nothing happens, no error message in Python console
Expected behavior
Format the code
Details
Python console shows this command: /usr/local/bin/python3 ~/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/pyvsc-run-isolated.py yapf --diff ~/test.py
When I run this command in the console, it only prints the diff. Instead the command should be /usr/local/bin/python3 ~/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/pyvsc-run-isolated.py yapf -i ~/test.py
My understanding of yapf is that it only writes files if passed with the “-i” (–in-place) flag. Unfortunately, I can’t add this as additional parameter because --diff and -i are incompatible. How I can remove the addition of the --diff flag?
Also tested with and without passing --style="/home/ubuntu/setup.cfg"
[yapf]
based_on_style = pep8
column_limit = 100
settings.json:
{
"python.linting.pylintEnabled": true,
"python.formatting.provider": "yapf",
"editor.formatOnSave": true
}
Your Jupyter and/or Python environment
Please provide as much info as you readily know
- Jupyter server running: remote
- Extension version: 2020.6.88468
- VS Code version: 1.46.0
- Setting python.jediEnabled: true
- Setting python.languageServer: Jedi
- Python and/or Anaconda version: Python 3.8.2
- OS: Ubuntu 18.04 LTS
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top GitHub Comments
Can we reopen this? I’m experiencing the same issue. If i provide a style file as an argument, then nothing gets reformatted, but if I remove it then it autoreformats. Here are the two commands that are generated:
(Doesn’t work)
(Formats the code, but not according to my custom settings)
This is recent (in the past few months) and seems like a bug to me
@nlarusstone created a separate issue for your scenario.