Search code examples
pythonformattingvscode-extensionsword-wrap

How to disable Word Wrap in VS Code with Python extension?


When I write Python code in VS Code, all long lines get split in half after saving. I've already figured out that this is related to the Python extension.

  • I've checked the user settings, where "WordWrap" is set to "Off." Is there anyone who can assist me with this? It's really annoying to write code like this.
  • In the settings of the Python extension, I couldn't find anything that might be related to WordWrap or formatting.
  • I had also found a few threads where a similar issue occurred. I tried the answers from these, unfortunately, it didn't work.

Solution

  • Check what your python formatting provider is in the settings.

    "python.formatting.provider": "autopep8"
    

    I only know a solution for autopep8.

    Try changing --max-line-length to a larger value say 500.

    "python.formatting.autopep8Args" : [ "--max-line-length=500" ]
    

    Hope this helps