How to setup vscode settings for Python formatter?
Question:
Somehow my formatter isn’t working. I pip installed yapf , but when I do Ctrl+Shift+P
-> Format Document or Shift + Alt + F
on a selected code, It doesn’t change. I heard it auto formats on save, but that didn’t work either.
I am trying to follow the guide here.
It mentions I should edit this part in the settings
"python.formatting.yapfArgs": ["--style", "{based_on_style: chromium, indent_width: 20}"],
But when I search this, this is the only thing I see
What I am trying to do at the moment is set the indent to 4 spaces, and also adjust the max line length.
This is what my settings look like for formatting
Answers:
Somehow my formatter isn’t working. I pip installed yapf , but when I do Ctrl+Shift+P
-> Format Document or Shift + Alt + F
on a selected code, It doesn’t change. I heard it auto formats on save, but that didn’t work either.
I am trying to follow the guide here.
It mentions I should edit this part in the settings
"python.formatting.yapfArgs": ["--style", "{based_on_style: chromium, indent_width: 20}"],
But when I search this, this is the only thing I see
What I am trying to do at the moment is set the indent to 4 spaces, and also adjust the max line length.
This is what my settings look like for formatting