0

I am using autopep8 as formatter for python in vscode.

Earlier when I used to save the file, vscode used to autoformat the file and wrap long lines. For example:

results['flagReason'] = results.apply(
    lambda x: flagger(x, return_type='reason'), axis=1)
results['flagMessage'] = results.apply(
    lambda x: flagger(x, return_type='message'), axis=1)

But what I write (or want) is:

results['flagReason'] = results.apply(lambda x: flagger(x, return_type='reason'), axis=1)
results['flagMessage'] = results.apply(lambda x: flagger(x, return_type='message'), axis=1)

For this, from this answer, I changed the settings of vscode and added the following in settings file:

"python.formatting.autopep8Args": ["--max-line-length", "120", "--experimental"]

The issue is when I try to reformat after adding these settings, the file does not reformat and wrapped lines do not unwrap i.e. does not change to how i want.

Please help...

Peter Macej
  • 4,831
  • 22
  • 49
monte
  • 1,482
  • 1
  • 10
  • 26

1 Answers1

0

Please use the following settings and see if it solves your question:

"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 120
Molly Wang-MSFT
  • 7,943
  • 2
  • 9
  • 22